Class ExpressionNode
- java.lang.Object
-
- com.yahoo.searchlib.rankingexpression.rule.ExpressionNode
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CompositeNode
,ConstantNode
,GBDTForestNode
,GBDTNode
,NameNode
public abstract class ExpressionNode extends Object implements Serializable
Superclass of all expression nodes. Expression nodes have their identity determined by their content. All expression nodes are immutable.- Author:
- Simon Thoresen Hult
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExpressionNode()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
abstract Value
evaluate(Context context)
Returns the value of evaluating this expression over the given context.int
hashCode()
String
toString()
StringBuilder
toString(SerializationContext context)
abstract StringBuilder
toString(StringBuilder builder, SerializationContext context, Deque<String> path, CompositeNode parent)
Returns a script instance of this based on the supplied script functions.abstract com.yahoo.tensor.TensorType
type(com.yahoo.tensor.evaluation.TypeContext<Reference> context)
Returns the type this will return if evaluated with the given context.
-
-
-
Method Detail
-
toString
public final StringBuilder toString(SerializationContext context)
-
toString
public abstract StringBuilder toString(StringBuilder builder, SerializationContext context, Deque<String> path, CompositeNode parent)
Returns a script instance of this based on the supplied script functions.- Parameters:
builder
- the StringBuilder that will be appended tocontext
- the serialization contextpath
- the call path to this, used for cycle detection, or null if this is a rootparent
- the parent node of this, or null if it a root- Returns:
- the main script, referring to script instances.
-
type
public abstract com.yahoo.tensor.TensorType type(com.yahoo.tensor.evaluation.TypeContext<Reference> context)
Returns the type this will return if evaluated with the given context.- Parameters:
context
- the variable type bindings to use for this evaluation- Throws:
IllegalArgumentException
- if there are variables which are not bound in the given map
-
evaluate
public abstract Value evaluate(Context context)
Returns the value of evaluating this expression over the given context.- Parameters:
context
- the variable bindings to use for this evaluation- Throws:
IllegalArgumentException
- if there are variables which are not bound in the given map
-
-