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
An abstract class for different types of boolean expressions
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe label associated with this expression (may be null)Fields inherited from class org.jfuncmachine.compiler.model.SourceElement
filename, lineNumber -
Constructor Summary
ConstructorsConstructorDescriptionBooleanExpr(String filename, int lineNumber) Create a new BooleanExpr associated with a particular source filename and line number -
Method Summary
Modifier and TypeMethodDescriptionabstract BooleanExprcomputeSequence(BooleanExpr trueNext, BooleanExpr falseNext, List<BooleanExpr> tests) Compute a sequence of tests to determine if this expression is true or falseabstract BooleanExprinvert()Invert this expression, which may involve reversing comparisons or changing and to or with inverted tests, etc.abstract BooleanExprRemove any not expressions from a tree of boolean expressions by inverting the expression under the notvoidreset()Resets any values modified during code generationMethods inherited from class org.jfuncmachine.compiler.model.SourceElement
generateException
-
Field Details
-
label
The label associated with this expression (may be null)
-
-
Constructor Details
-
BooleanExpr
Create a new BooleanExpr associated with a particular source filename and line number- Parameters:
filename- The source filename this expression is associated withlineNumber- The source line number this expression is associated with
-
-
Method Details
-
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
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 truefalseNext- The next expression to evaluate if this expression is falsetests- An accumulator for the tests to be executed- Returns:
- The beginning of the sequence
-