Package org.teiid.query.processor.proc
Class IfInstruction
- java.lang.Object
-
- org.teiid.query.processor.proc.ProgramInstruction
-
- org.teiid.query.processor.proc.IfInstruction
-
- All Implemented Interfaces:
Cloneable
public class IfInstruction extends ProgramInstruction
This instruction an holds an if block and an else block and a criteria that determines which block will be executed. These blocks are
Program
objects that could contain nested if-else block. Therefore, thisProgramInstruction
implements an arbitrarily deep if-else if-....else block.During processing, the Criteria is evaluated and if it evaluates to true, the "if" block is executed else the "else" block if there is one is executed. These programs are placed on the stack.
-
-
Constructor Summary
Constructors Constructor Description IfInstruction(Criteria condition, Program ifProgram)
Constructor for IfInstruction.IfInstruction(Criteria condition, Program ifProgram, Program elseProgram)
Constructor for IfInstruction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IfInstruction
clone()
Returns a deep clonePlanNode
getDescriptionProperties()
Program
getElseProgram()
Program
getIfProgram()
void
process(ProcedurePlan procEnv)
This instruction will evaluate it's criteria, if it evaluates to true, it will push the corresponding sub Program on to the top of the program stack, and break from the loop.Boolean
requiresTransaction(boolean transactionalReads)
String
toString()
-
-
-
Constructor Detail
-
IfInstruction
public IfInstruction(Criteria condition, Program ifProgram, Program elseProgram)
Constructor for IfInstruction.- Parameters:
condition
- TheCriteria
used to determine which block to executeifProgram
- TheProgram
representing the "if" blockelseProgram
- TheProgram
representing the "else" block
-
-
Method Detail
-
process
public void process(ProcedurePlan procEnv) throws BlockedException, TeiidComponentException, TeiidProcessingException
This instruction will evaluate it's criteria, if it evaluates to true, it will push the corresponding sub Program on to the top of the program stack, and break from the loop. Regardless if whether any criteria evaluate to true, this instruction will increment the program counter of the current program.- Specified by:
process
in classProgramInstruction
- Throws:
TeiidProcessingException
BlockedException
TeiidComponentException
- See Also:
ProgramInstruction.process(ProcedurePlan)
-
getIfProgram
public Program getIfProgram()
-
getElseProgram
public Program getElseProgram()
-
clone
public IfInstruction clone()
Returns a deep clone- Overrides:
clone
in classProgramInstruction
- Returns:
- shallow clone
-
getDescriptionProperties
public PlanNode getDescriptionProperties()
- Specified by:
getDescriptionProperties
in classProgramInstruction
-
requiresTransaction
public Boolean requiresTransaction(boolean transactionalReads)
- Overrides:
requiresTransaction
in classProgramInstruction
-
-