Interface ITree

  • All Implemented Interfaces:
    java.io.Serializable

    
    public interface ITree
     implements Serializable
                        

    Represents a Tree of Objects(Node) of generic type T. The Tree is represented as a single rootElement which points to a List

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract ITree assignVarValue(Map<HashString, ITreeNode<out Object>> matches) This method substitutes variables present in matches map with their values.
      abstract double evaluation(Map<HashString, ITreeNode<out Object>> matches) This evaluates the expression.
      abstract ITreeNode<out Object> getRoot() Return the root Node of the tree.
      abstract HashString toHashString() Similar to toString(), but returns a HashString.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • assignVarValue

         abstract ITree assignVarValue(Map<HashString, ITreeNode<out Object>> matches)

        This method substitutes variables present in matches map with their values. It must involve only node of Typ=Var. The method must also recognize the values type stored in the map (they can be Const or Num).

        Parameters:
        matches - the map with variable values already assigned.
        Returns:

        a new ITree containing the instantiated variable

      • evaluation

         abstract double evaluation(Map<HashString, ITreeNode<out Object>> matches)

        This evaluates the expression. If the matches map contains values which are not instanced, and the expression value cannot consequently be computed, 0d is returned.

        Parameters:
        matches - the map that binds each variable with its own value
        Returns:

        A number representing the value for this expression. If the expression can't be computed, NaN is returned.

      • getRoot

         abstract ITreeNode<out Object> getRoot()

        Return the root Node of the tree.

        Returns:

        the root element.

      • toHashString

         abstract HashString toHashString()

        Similar to toString(), but returns a HashString.

        Returns:

        a HashString representation of this Object