Class Expression


  • public final class Expression
    extends java.lang.Object
    This class represents a HTL Expression.
    • Constructor Detail

      • Expression

        public Expression​(ExpressionNode root)
        Create an expression with just a root node.
        Parameters:
        root - the root node
      • Expression

        public Expression​(ExpressionNode root,
                          java.util.Map<java.lang.String,​ExpressionNode> options)
        Create an expression with a root node and options.
        Parameters:
        root - the root node
        options - the expression's options
      • Expression

        public Expression​(ExpressionNode root,
                          java.util.Map<java.lang.String,​ExpressionNode> options,
                          java.lang.String rawText)
        Create an expression with a root node and options.
        Parameters:
        root - the root node
        options - the expression's options
        rawText - the expression's raw text representation
    • Method Detail

      • getOptions

        public java.util.Map<java.lang.String,​ExpressionNode> getOptions()
        Get the options for this expression.
        Returns:
        the expression options
      • getRoot

        public ExpressionNode getRoot()
        Get the root node of this expression.
        Returns:
        the root node of this expression
      • removeOption

        public ExpressionNode removeOption​(java.lang.String option)
        Removes the given option from this expression.
        Parameters:
        option - the option to be removed
        Returns:
        the option, or null if the option doesn't exist
      • withNode

        public Expression withNode​(ExpressionNode node)
        Return a copy, but with the specified node as root.
        Parameters:
        node - the new root
        Returns:
        a copy with a new root
      • withRawText

        public Expression withRawText​(java.lang.String rawText)
        Return a copy that provides information about the expression's raw text.
        Parameters:
        rawText - the raw text representing the expression
        Returns:
        a copy with information about the expression's raw text
      • getRawText

        public java.lang.String getRawText()
        Returns the raw text representation of this expression.
        Returns:
        the raw text representation of this expression
      • containsOption

        public boolean containsOption​(java.lang.String name)
        Checks whether the expression has the specified option.
        Parameters:
        name - the name of the option
        Returns:
        true if the option is present, false otherwise
      • toString

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