Class SelectNode

All Implemented Interfaces:
IParsedExpression, Node, Serializable

public class SelectNode extends ExpressionNode
Node for OQL like select statements.
See Also:
  • Field Details

    • ALL

      public static final int ALL
      The selection mode for returning a set of elements (default).
      See Also:
    • ANY

      public static final int ANY
      The selection mode for returning the first matching element.
      See Also:
    • IOTA

      public static final int IOTA
      The selection mode for returning a single matching element.
      See Also:
    • ASC

      public static final int ASC
      The ascending order direction.
      See Also:
    • DESC

      public static final int DESC
      The descending order direction.
      See Also:
    • mode

      protected int mode
      The selection mode.
    • vars

      protected String[] vars
      The variable names.
    • where

      protected boolean where
      The flag indicating presence of a where clause.
    • orderby

      protected boolean orderby
      The flag indicating presence of an order by clause.
    • order

      protected int order
      The order direction.
  • Constructor Details

    • SelectNode

      public SelectNode(jadex.javaparser.javaccimpl.ParserImpl p, int id)
      Create a node.
      Parameters:
      p - The parser.
      id - The id.
  • Method Details

    • setText

      public void setText(String text)
      Set the token text.
      Overrides:
      setText in class ExpressionNode
      Parameters:
      text - The token text.
    • setVariables

      public void setVariables(String[] vars)
      Set the variable names.
    • setWhere

      public void setWhere(boolean where)
      Set the where clause flag.
    • setOrderBy

      public void setOrderBy(boolean orderby)
      Set the where order by flag.
    • setOrder

      public void setOrder(String order)
      Set the ordering direction.
    • precompile

      public void precompile()
      Precompile the node.
      Overrides:
      precompile in class ExpressionNode
    • getValue

      public Object getValue(jadex.common.IValueFetcher fetcher)
      Evaluate the expression in the given state with respect to given parameters.
      Specified by:
      getValue in interface IParsedExpression
      Specified by:
      getValue in class ExpressionNode
      Parameters:
      params - The parameters (string, value pairs), if any.
      Returns:
      The value of the term.
    • toPlainString

      public String toPlainString()
      Create a string representation of this node and its subnodes.
      Specified by:
      toPlainString in interface Node
      Overrides:
      toPlainString in class ExpressionNode
      Returns:
      A string representation of this node.
    • getUnboundParameterNodes

      public ParameterNode[] getUnboundParameterNodes()
      Get unbound parameter nodes.
      Overrides:
      getUnboundParameterNodes in class ExpressionNode
      Returns:
      The unbound parameter nodes.
    • toString

      public static String toString(int mode)
      Convert a selection mode to a string representation.
      Parameters:
      mode - The mode
      Returns:
      A string representation of the mode.
    • orderToString

      public static String orderToString(int order)
      Convert an ordering direction to a string representation.
      Parameters:
      order - The ordering direction
      Returns:
      A string representation of the ordering direction.
    • fromString

      public static int fromString(String mode)
      Convert a selection mode from a string representation.
      Parameters:
      mode - The mode as string.
      Returns:
      The int value of the mode.
    • orderFromString

      public static int orderFromString(String order)
      Convert an ordering direction from a string representation.
      Parameters:
      order - The ordering direction as string.
      Returns:
      The int value of the ordering direction.
    • equals

      public boolean equals(Object o)
      Test if two nodes are equal.
      Overrides:
      equals in class ExpressionNode
    • hashCode

      public int hashCode()
      Get the hash code for the node.
      Overrides:
      hashCode in class ExpressionNode