org.teiid.query.processor.xml
Class IfInstruction

java.lang.Object
  extended by org.teiid.query.processor.xml.ProcessorInstruction
      extended by org.teiid.query.processor.xml.IfInstruction

public class IfInstruction
extends ProcessorInstruction

This instruction holds a List of Criteria, and for each Criteria there is a Program that will be executed. Therefore, this ProcessorInstruction implements an arbitrarily deep if-else if-....else block.

During processing, the Criteria are iterated through, in order. When one evaluates to true, that Criteria's Program is placed on to the Program stack, and the loop is broken - this simulates the if-else if-... behavior. An optional "else" or "default" Program can be added via the addDefaultChoiceSubProgram method - this is the optional "else" block at the end of an if-else if-... construct.


Constructor Summary
IfInstruction()
          Constructor for IfInstruction.
 
Method Summary
 void addCondition(Condition condition)
           
 PlanNode getDescriptionProperties()
           
 org.teiid.query.processor.xml.XMLContext process(XMLProcessorEnvironment env, org.teiid.query.processor.xml.XMLContext context)
          This instruction will evaluate it's criteria, one by one.
 void setDefaultCondition(DefaultCondition defaultCondition)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IfInstruction

public IfInstruction()
Constructor for IfInstruction.

Parameters:
endIf - see #getEndIf
Method Detail

addCondition

public void addCondition(Condition condition)

setDefaultCondition

public void setDefaultCondition(DefaultCondition defaultCondition)

process

public org.teiid.query.processor.xml.XMLContext process(XMLProcessorEnvironment env,
                                                        org.teiid.query.processor.xml.XMLContext context)
                                                 throws BlockedException,
                                                        TeiidComponentException,
                                                        TeiidProcessingException
This instruction will evaluate it's criteria, one by one. If any evaluate 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 class ProcessorInstruction
Parameters:
env - instance of ProcessorEnvironment which is being used for the processing of the XML document model query
Throws:
BlockedException - if data is not available now but may be at a later time
TeiidComponentException - for non-business exception
TeiidProcessingException - for business exception due to user input or model
See Also:
ProcessorInstruction#process(ProcessorEnvironment)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDescriptionProperties

public PlanNode getDescriptionProperties()
Specified by:
getDescriptionProperties in class ProcessorInstruction


Copyright © 2010. All Rights Reserved.