Class BooleanExpr

java.lang.Object
org.jfuncmachine.compiler.model.SourceElement
org.jfuncmachine.compiler.model.expr.bool.BooleanExpr
Direct Known Subclasses:
And, BinaryComparison, BoolFalse, BoolTrue, InstanceofComparison, Not, Or, Result, UnaryComparison

public abstract class BooleanExpr extends SourceElement
An abstract class for different types of boolean expressions
  • Field Details

    • label

      public Label label
      The label associated with this expression (may be null)
  • Constructor Details

    • BooleanExpr

      public BooleanExpr(String filename, int lineNumber)
      Create a new BooleanExpr associated with a particular source filename and line number
      Parameters:
      filename - The source filename this expression is associated with
      lineNumber - The source line number this expression is associated with
  • Method Details

    • invert

      public abstract BooleanExpr invert()
      Invert this expression, which may involve reversing comparisons or changing and to or with inverted tests, etc.
      Returns:
      An inverted boolean expression
    • reset

      public void reset()
      Resets any values modified during code generation
    • removeNot

      public abstract BooleanExpr removeNot()
      Remove any not expressions from a tree of boolean expressions by inverting the expression under the not
      Returns:
      a BooleanExpr with any nested Not constructions removed
    • computeSequence

      public abstract BooleanExpr computeSequence(BooleanExpr trueNext, BooleanExpr falseNext, List<BooleanExpr> tests)
      Compute a sequence of tests to determine if this expression is true or false
      Parameters:
      trueNext - The next expression to evaluate if this expression is true
      falseNext - The next expression to evaluate if this expression is false
      tests - An accumulator for the tests to be executed
      Returns:
      The beginning of the sequence