net.sf.joost.instruction
Class ForEachFactory.Instance

java.lang.Object
  extended by net.sf.joost.instruction.AbstractInstruction
      extended by net.sf.joost.instruction.NodeBase
          extended by net.sf.joost.instruction.ForEachFactory.Instance
All Implemented Interfaces:
Cloneable, Constants
Enclosing class:
ForEachFactory

public final class ForEachFactory.Instance
extends NodeBase

Represents an instance of the for-each-item element.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.joost.instruction.NodeBase
NodeBase.End
 
Field Summary
private  AbstractInstruction contents
           
private  boolean continued
          Determines whether this instruction is encountered the first time (false; i.e. the select attribute needs to be evaluated) or during the processing (true; i.e. this is part of the loop)
private  String expName
           
private  Stack resultStack
          Stack that stores the remaining sequence of the select attribute in case this for-each-item was interrupted via stx:process-xxx
private  Tree select
           
private  AbstractInstruction successor
           
private  String varName
           
 
Fields inherited from class net.sf.joost.instruction.NodeBase
lastChild, localFieldStack, nodeEnd, parent, preserveSpace, publicId, qName, scopedVariables, systemId
 
Fields inherited from class net.sf.joost.instruction.AbstractInstruction
colNo, lineNo, next
 
Fields inherited from interface net.sf.joost.Constants
DEBUG, DEFAULT_ENCODING, FEAT_NS, FEAT_NSPREFIX, FEATURE_URI_PREFIX, FUNC_NS, JOOST_EXT_NS, PR_ATTRIBUTES, PR_BUFFER, PR_CHILDREN, PR_CONTINUE, PR_ERROR, PR_SELF, PR_SIBLINGS, STX_NS
 
Constructor Summary
protected ForEachFactory.Instance(String qName, NodeBase parent, ParseContext context, String varName, String expName, Tree select)
           
 
Method Summary
 boolean compile(int pass, ParseContext context)
          Create the loop by connecting the end with the start
protected  void onDeepCopy(AbstractInstruction copy, HashMap copies)
          Callback that will be called when a clone of this instance has been created.
 short process(Context context)
          If continued is true then take the next item from a previously computed sequence, otherwise evaluate the select attribute and take the first item.
 short processEnd(Context context)
          Sets continued to true to signal the loop.
 
Methods inherited from class net.sf.joost.instruction.NodeBase
declareVariable, getNode, getNodeEnd, insert, mayDropEnd, processable, setEndLocation, toString
 
Methods inherited from class net.sf.joost.instruction.AbstractInstruction
deepCopy, deepHashtableCopy, deepTemplateArrayCopy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

varName

private String varName

expName

private String expName

select

private Tree select

resultStack

private Stack resultStack
Stack that stores the remaining sequence of the select attribute in case this for-each-item was interrupted via stx:process-xxx


contents

private AbstractInstruction contents

successor

private AbstractInstruction successor

continued

private boolean continued
Determines whether this instruction is encountered the first time (false; i.e. the select attribute needs to be evaluated) or during the processing (true; i.e. this is part of the loop)

Constructor Detail

ForEachFactory.Instance

protected ForEachFactory.Instance(String qName,
                                  NodeBase parent,
                                  ParseContext context,
                                  String varName,
                                  String expName,
                                  Tree select)
Method Detail

compile

public boolean compile(int pass,
                       ParseContext context)
Create the loop by connecting the end with the start

Overrides:
compile in class NodeBase
Parameters:
pass - the number of invocations already performed on this node
context - the parse context
Returns:
true if another invocation in the next pass is necessary, false if the compiling is complete. This instance returns false.

process

public short process(Context context)
              throws SAXException
If continued is true then take the next item from a previously computed sequence, otherwise evaluate the select attribute and take the first item.

Overrides:
process in class NodeBase
Parameters:
context - the current context
Returns:
Constants.PR_CONTINUE
Throws:
SAXException - if an error occurs (in a derived class)

processEnd

public short processEnd(Context context)
                 throws SAXException
Sets continued to true to signal the loop.

Overrides:
processEnd in class NodeBase
Parameters:
context - the current context
Returns:
Constants.PR_CONTINUE
Throws:
SAXException - if an error occurs (in a derived class)

onDeepCopy

protected void onDeepCopy(AbstractInstruction copy,
                          HashMap copies)
Description copied from class: AbstractInstruction
Callback that will be called when a clone of this instance has been created. To be overridden in subclasses.

Overrides:
onDeepCopy in class NodeBase
Parameters:
copy - the created clones
copies - the map of already copied objects