Class ExpressionNode

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    CompositeNode, ConstantNode, NameNode

    public abstract class ExpressionNode
    extends java.lang.Object
    implements java.io.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​(java.lang.Object obj)  
      abstract Value evaluate​(Context context)
      Returns the value of evaluating this expression over the given context.
      int hashCode()  
      java.lang.String toString()  
      java.lang.StringBuilder toString​(SerializationContext context)  
      abstract java.lang.StringBuilder toString​(java.lang.StringBuilder builder, SerializationContext context, java.util.Deque<java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ExpressionNode

        public ExpressionNode()
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public abstract java.lang.StringBuilder toString​(java.lang.StringBuilder builder,
                                                         SerializationContext context,
                                                         java.util.Deque<java.lang.String> path,
                                                         CompositeNode parent)
        Returns a script instance of this based on the supplied script functions.
        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 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:
        java.lang.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:
        java.lang.IllegalArgumentException - if there are variables which are not bound in the given map