Class RelOpClause

All Implemented Interfaces:
Clause, TopLevelClause

public class RelOpClause extends AbstractClause implements TopLevelClause
Represents a clause which compares subclauses, using one of the relative operators supported by the Operator class.
See Also:
  • Field Details

    • value

      protected boolean value
    • operator

      protected int operator
    • lhs

      protected SubClause lhs
    • rhs

      protected List rhs
  • Constructor Details

    • RelOpClause

      protected RelOpClause(int operator, SubClause lhs, List rhs) throws DAP2ServerSideException
      Creates a new RelOpClause. If the lhs and all the elements of the rhs are constant, the RelOpClause will be flagged as constant, and evaluated immediately.
      Parameters:
      operator - The operator invoked by the clause
      lhs - The left-hand side of the comparison.
      rhs - A list of SubClauses representing the right-hand side of the comparison.
      Throws:
      DAP2ServerSideException - Thrown if the clause is constant, but the attempt to evaluate it fails.
  • Method Details

    • getValue

      public boolean getValue()
      Description copied from interface: TopLevelClause
      Returns the current value of the clause. The value of non-constant Clauses is undefined until the evaluate() method has been called.
      Specified by:
      getValue in interface TopLevelClause
    • evaluate

      public boolean evaluate() throws DAP2ServerSideException
      Description copied from interface: TopLevelClause
      Evaluates the clause, first calling evaluate() on any sub-clauses it contains. Implementations of this method should flag the clause as "defined" if the evaluation is successful.
      Specified by:
      evaluate in interface TopLevelClause
      Throws:
      DAP2ServerSideException - Thrown if the evaluation fails for any reason.
    • getLHS

      public SubClause getLHS()
      Returns a SubClause representing the right-hand side of the comparison.
    • getRHS

      public List getRHS()
      Returns a list of SubClauses representing the right-hand side of the comparison.
    • getOperator

      public int getOperator()
      Returns the type of comparison
      See Also:
    • printConstraint

      public void printConstraint(PrintWriter os)
      Prints the original string representation of this clause. For use in debugging.
      Specified by:
      printConstraint in interface Clause