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:
  • Constructor Details

    • ExpressionNode

      public ExpressionNode()
  • Method Details

    • toString

      public abstract StringBuilder toString(StringBuilder builder, SerializationContext context, Deque<String> path, CompositeNode parent)
      Returns this in serialized form.
      Parameters:
      builder - the StringBuilder that will be appended to
      context - the serialization context
      path - the call path to this, used for cycle detection, or null if this is a root
      parent - the parent node of this, or null if it is 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
    • toString

      public final StringBuilder toString(SerializationContext context)
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public abstract int hashCode()
      Returns a hashcode computed from the data in this
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object