com.hp.hpl.jena.graph.query
Class Dyadic

java.lang.Object
  extended by com.hp.hpl.jena.graph.query.Expression.Base
      extended by com.hp.hpl.jena.graph.query.Expression.Application
          extended by 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.

Author:
kers

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.hp.hpl.jena.graph.query.Expression
Expression.Application, Expression.Base, Expression.BoolConstant, Expression.Constant, Expression.Fixed, Expression.Util, Expression.Valof, Expression.Variable
 
Field Summary
 
Fields inherited from interface com.hp.hpl.jena.graph.query.Expression
FALSE, TRUE
 
Constructor Summary
Dyadic(Expression L, String F, Expression R)
           
 
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(Object l, Object r)
          Answer the boolean result of evaluating this dyadic expression with the given arguments l and r.
 Object evalObject(Object l, 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.
 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]
 String toString()
           
 
Methods inherited from class com.hp.hpl.jena.graph.query.Expression.Application
isApply
 
Methods inherited from class com.hp.hpl.jena.graph.query.Expression.Base
equals, getName, getValue, isConstant, isVariable
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Dyadic

public Dyadic(Expression L,
              String F,
              Expression R)
Method Detail

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 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 Object evalObject(Object l,
                         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(Object l,
                        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 String toString()
Overrides:
toString in class Object

and

public static Expression and(Expression L,
                             Expression R)


Licenced under the Apache License, Version 2.0