Class SemanticNodeBase

java.lang.Object
com.aquima.interactions.expressions.semantics.SemanticNodeBase
All Implemented Interfaces:
ISemanticNode
Direct Known Subclasses:
AllVariable, Arithmetic, Condition, Constant, Conversion, DimensionChange, ErrorNode, ExpressionList, FieldVariable, FunctionCall, InstanceOf, Inversion, ListArithmetic, ListCondition, LocalVariable, LogicalConnective, NamedVariable, Not, Predicate, Root, Select, TemplateCall, TypeOf, Unknown, Variable

public abstract class SemanticNodeBase extends Object implements ISemanticNode
Base class for all nodes from the semantic tree.
Since:
6.0
Author:
O. Kerpershoek, F. van der Meer
  • Constructor Details

    • SemanticNodeBase

      protected SemanticNodeBase(Position position)
  • Method Details

    • setType

      protected void setType(DataType type, boolean multivalue)
    • setType

      protected void setType(Type type)
    • setDomain

      protected void setDomain(Domain domain)
    • setDerived

      protected void setDerived(boolean isDerived)
    • getPosition

      public Position getPosition()
      Description copied from interface: ISemanticNode
      This method returns the position information of the node.
      Specified by:
      getPosition in interface ISemanticNode
      Returns:
      The position information of the node.
    • getType

      public Type getType()
      Description copied from interface: ISemanticNode
      This method returns the type information of the node. The type information is a combination of the data type, the domain and the multivalue indicator.
      Specified by:
      getType in interface ISemanticNode
      Returns:
      The type information of the node.
    • getDataType

      public DataType getDataType()
      Description copied from interface: ISemanticNode
      This method returns the data type of the node.
      Specified by:
      getDataType in interface ISemanticNode
      Returns:
      the data type of the node.
    • isMultivalue

      public boolean isMultivalue()
      Description copied from interface: ISemanticNode
      This method returns a boolean indicating if the expression will result in multiple values.
      Specified by:
      isMultivalue in interface ISemanticNode
      Returns:
      a boolean indicating if the expression will result in multiple values.
    • getDomain

      public Domain getDomain()
      Description copied from interface: ISemanticNode
      This method returns the domain of values that may be returned by the expression.
      Specified by:
      getDomain in interface ISemanticNode
      Returns:
      the domain of values that may be returned by the expression.
    • isDerivedType

      public boolean isDerivedType()
      Description copied from interface: ISemanticNode
      This method returns a boolean indicating if the type of this node is derived. A derived type is usually the result of an operation where the result type may be ambiguous. For instance the multiplication of a number with a percentage, may result in either a number or a percentage. Usually the most specific type is chosen (percentage in the previous example). Nodes representing constants or variables will often return false as a result of this method.
      Specified by:
      isDerivedType in interface ISemanticNode
      Returns:
      a boolean indicating if the type of this node is derived.
    • getMessages

      public final ErrorMessage[] getMessages(Severity severity, boolean includeChildMessages)
      Description copied from interface: ISemanticNode
      This method returns an array of messages that were detected while parsing the node. If the severity parameter is null, all messages will be returned regardless of their severity. When a severity is specified, only the messages matching the severity will be returned. The boolean argument may be used to indicate if only the messages of this node should be returned, or also the messages of any child nodes.
      Specified by:
      getMessages in interface ISemanticNode
      Parameters:
      severity - The severity may be used to request only the messages matching the specified severity.
      includeChildMessages - Boolean indicating if child messages should also be returned.
      Returns:
      Array of messages that were detected during the parse phase for this node.
    • addMessage

      public void addMessage(Severity severity, ErrorMessage message)
      Description copied from interface: ISemanticNode
      This method adds a message to the semantic node.
      Specified by:
      addMessage in interface ISemanticNode
      Parameters:
      severity - The severity of the message.
      message - The message that should be added.
    • hasMessage

      public boolean hasMessage(Severity severity, ErrorCode errorCode, boolean includeChildMessages)
      Description copied from interface: ISemanticNode
      This method detects whether a specific message is found within the semantic node. The boolean argument may be used to indicate if only the messages of this node should be checked, or also the messages of any child nodes. The severity parameter may be used to specify if only messages matching that severity should be searched. When the severity parameter is null, all messages regardless of severity will be searched.
      Specified by:
      hasMessage in interface ISemanticNode
      Parameters:
      severity - The severity of the error (optional).
      errorCode - The error code for which to search.
      includeChildMessages - Boolean indicating if child messages should also be checked.
      Returns:
      A boolean indicating the error was found in the node.
    • toString

      public String toString()
      Overrides:
      toString in class Object