Class ComparisonNode

  • All Implemented Interfaces:
    ExpressionNode

    public class ComparisonNode
    extends java.lang.Object
    implements ExpressionNode
    Author:
    Simon Thoresen Hult
    • Constructor Detail

      • ComparisonNode

        public ComparisonNode​(ExpressionNode lhs,
                              java.lang.String operator,
                              ExpressionNode rhs)
        Constructs a new comparison node.
        Parameters:
        lhs - The left-hand-side of the comparison.
        operator - The comparison operator.
        rhs - The right-hand-side of the comparison.
    • Method Detail

      • getLHS

        public ExpressionNode getLHS()
        Returns the left hand side of this comparison.
        Returns:
        The left hand side expression.
      • getOperator

        public java.lang.String getOperator()
        Returns the comparison operator of this.
        Returns:
        The operator.
      • setOperator

        public ComparisonNode setOperator​(java.lang.String operator)
        Sets the comparison operator of this.
        Parameters:
        operator - The operator string.
        Returns:
        This, to allow chaining.
      • getRHS

        public ExpressionNode getRHS()
        Returns the right hand side of this comparison.
        Returns:
        The right hand side expression.
      • evaluate

        public java.lang.Object evaluate​(Context context)
        Description copied from interface: ExpressionNode
        Evaluate the content of this node based on document object, and return that value.
        Specified by:
        evaluate in interface ExpressionNode
        Parameters:
        context - the document to evaluate over.
        Returns:
        the value of this.
      • accept

        public void accept​(Visitor visitor)
        Description copied from interface: ExpressionNode
        Perform visitation of this node.
        Specified by:
        accept in interface ExpressionNode
        Parameters:
        visitor - the visitor that wishes to visit the node.
      • toString

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