java.lang.Object
com.hp.hpl.jena.graph.query.Expression.Base
com.hp.hpl.jena.graph.query.Expression.Application
com.hp.hpl.jena.graph.query.Dyadic
- All Implemented Interfaces:
- Expression
- Direct Known Subclasses:
- Rewrite.DyadicLiteral
- public abstract class Dyadic
- extends Expression.Application
A base class for dyadic expressions with a built-in Valuator; subclasses must
define an evalObject or evalBool method which will be supplied with the
evaluated operands.
|
Method Summary |
static Expression |
and(Expression L,
Expression R)
|
int |
argCount()
If this Expression is an application, answer the number of arguments that
it has. |
boolean |
evalBool(java.lang.Object l,
java.lang.Object r)
Answer the boolean result of evaluating this dyadic expression with
the given arguments l and r. |
java.lang.Object |
evalObject(java.lang.Object l,
java.lang.Object r)
Answer the Object result of evaluating this dyadic expression with
the given arguments l and r. |
Expression |
getArg(int i)
If this Expression is an application, and 0 <= i < argCount(), answer the
ith argument. |
java.lang.String |
getFun()
If this Expression is an application, return the string identifying the function,
which should be a URI. |
Valuator |
prepare(VariableIndexes vi)
Answer a Valuator which, when run with a set of index-to-value bindings,
evaluates this expression in the light of the given variable-to-index bindings
[ie as though the variables were bound to the corresponding values] |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
L
protected Expression L
R
protected Expression R
F
protected java.lang.String F
Dyadic
public Dyadic(Expression L,
java.lang.String F,
Expression R)
argCount
public int argCount()
- Description copied from interface:
Expression
- If this Expression is an application, answer the number of arguments that
it has. Otherwise the behaviour is unspecified.
- Specified by:
argCount in interface Expression- Specified by:
argCount in class Expression.Application
getArg
public Expression getArg(int i)
- Description copied from interface:
Expression
- If this Expression is an application, and 0 <= i < argCount(), answer the
ith argument. Otherwise the behaviour is unspecified.
- Specified by:
getArg in interface Expression- Specified by:
getArg in class Expression.Application
getFun
public java.lang.String getFun()
- Description copied from interface:
Expression
- If this Expression is an application, return the string identifying the function,
which should be a URI. Otherwise the behaviour is unspecified.
- Specified by:
getFun in interface Expression- Specified by:
getFun in class Expression.Application
evalObject
public java.lang.Object evalObject(java.lang.Object l,
java.lang.Object r)
- Answer the Object result of evaluating this dyadic expression with
the given arguments
l and r.
Either this method or evalBool must be
over-ridden in concrete sub-classes.
evalBool
public boolean evalBool(java.lang.Object l,
java.lang.Object r)
- Answer the boolean result of evaluating this dyadic expression with
the given arguments
l and r.
Either this method or evalObject must be
over-ridden in concrete sub-classes.
prepare
public Valuator prepare(VariableIndexes vi)
- Description copied from interface:
Expression
- Answer a Valuator which, when run with a set of index-to-value bindings,
evaluates this expression in the light of the given variable-to-index bindings
[ie as though the variables were bound to the corresponding values]
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).
and
public static Expression and(Expression L,
Expression R)