Class TypeSwitchCase
java.lang.Object
org.jfuncmachine.compiler.model.SourceElement
org.jfuncmachine.compiler.model.expr.TypeSwitchCase
Defines a case value for a class switch statement containing a target value, an optional
extra comparison, and an expression to be executed if the switch value matches the case value.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BooleanExprAn additional expression to execute to check whether target matches this case value.final ExpressionThe expression to execute if the switch value equals this case valuefinal ObjectThe class (ObjectType value) that this case matches, or a string, or an intFields inherited from class org.jfuncmachine.compiler.model.SourceElement
filename, lineNumber -
Constructor Summary
ConstructorsConstructorDescriptionTypeSwitchCase(Integer target, Expression expr) Create a switch case for an integer targetTypeSwitchCase(Integer target, Expression expr, String filename, int lineNumber) Create a switch case for an integer targetTypeSwitchCase(String target, Expression expr) Create a switch case for a string targetTypeSwitchCase(String target, Expression expr, String filename, int lineNumber) Create a switch case for a string targetTypeSwitchCase(ObjectType target, BooleanExpr additionalComparison, Expression expr) Create a switch caseTypeSwitchCase(ObjectType target, BooleanExpr additionalComparison, Expression expr, String filename, int lineNumber) Create a switch caseTypeSwitchCase(ObjectType target, Expression expr) Create a switch case for a class targetTypeSwitchCase(ObjectType target, Expression expr, String filename, int lineNumber) Create a switch case for a class target -
Method Summary
Methods inherited from class org.jfuncmachine.compiler.model.SourceElement
generateException
-
Field Details
-
target
The class (ObjectType value) that this case matches, or a string, or an int -
additionalComparison
An additional expression to execute to check whether target matches this case value. @see "org.jfuncmachine.compiler.expr.TypeSwitch" This value can be null. -
expr
The expression to execute if the switch value equals this case value
-
-
Constructor Details
-
TypeSwitchCase
Create a switch case for a string target- Parameters:
target- The String to match against the switch targetexpr- The expression to execute if the switch value equals this case value
-
TypeSwitchCase
Create a switch case for an integer target- Parameters:
target- The String to match against the switch targetexpr- The expression to execute if the switch value equals this case value
-
TypeSwitchCase
Create a switch case for a class target- Parameters:
target- The String to match against the switch targetexpr- The expression to execute if the switch value equals this case value
-
TypeSwitchCase
Create a switch case for a string target- Parameters:
target- The String to match against the switch targetexpr- The expression to execute if the switch value equals this case valuefilename- The source filename containing this caselineNumber- The line number in the source filename where this case starts
-
TypeSwitchCase
Create a switch case for an integer target- Parameters:
target- The String to match against the switch targetexpr- The expression to execute if the switch value equals this case valuefilename- The source filename containing this caselineNumber- The line number in the source filename where this case starts
-
TypeSwitchCase
Create a switch case for a class target- Parameters:
target- The String to match against the switch targetexpr- The expression to execute if the switch value equals this case valuefilename- The source filename containing this caselineNumber- The line number in the source filename where this case starts
-
TypeSwitchCase
Create a switch case- Parameters:
target- The class that this case matchesadditionalComparison- An additional comparison to execute to make sure the target matches this caseexpr- The expression to execute if the switch value equals this case value
-
TypeSwitchCase
public TypeSwitchCase(ObjectType target, BooleanExpr additionalComparison, Expression expr, String filename, int lineNumber) Create a switch case- Parameters:
target- The class that this case matchesadditionalComparison- An additional comparison to execute to make sure the target matches this caseexpr- The expression to execute if the switch value equals this case valuefilename- The source filename containing this caselineNumber- The line number in the source filename where this case starts
-