net.sf.joost.instruction
Class TemplateFactory.Instance

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

public final class TemplateFactory.Instance
extends TemplateBase
implements Comparable

The inner Instance class


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.joost.instruction.NodeBase
NodeBase.End
 
Field Summary
private  Tree match
          The match pattern
private  double priority
          The priority of this template
 
Fields inherited from class net.sf.joost.instruction.TemplateBase
GLOBAL_VISIBLE, GROUP_VISIBLE, isPublic, LOCAL_VISIBLE, parentGroup, visibility, VISIBILITY_VALUES
 
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 TemplateFactory.Instance(String qName, NodeBase parent, ParseContext context, Tree match, double priority, int visibility, boolean isPublic, boolean newScope)
           
 
Method Summary
 int compareTo(Object o)
          Compares two templates according to their inverse priorities.
 Tree getMatchPattern()
           
 double getPriority()
           
 boolean matches(Context context, boolean setPosition)
           
protected  void onDeepCopy(AbstractInstruction copy, HashMap copies)
          Callback that will be called when a clone of this instance has been created.
 TemplateFactory.Instance split()
          Splits a match pattern that is a union into several template instances.
 String toString()
           
 
Methods inherited from class net.sf.joost.instruction.TemplateBase
process, processEnd
 
Methods inherited from class net.sf.joost.instruction.NodeBase
compile, declareVariable, getNode, getNodeEnd, insert, mayDropEnd, processable, setEndLocation
 
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

match

private Tree match
The match pattern


priority

private double priority
The priority of this template

Constructor Detail

TemplateFactory.Instance

protected TemplateFactory.Instance(String qName,
                                   NodeBase parent,
                                   ParseContext context,
                                   Tree match,
                                   double priority,
                                   int visibility,
                                   boolean isPublic,
                                   boolean newScope)
Method Detail

matches

public boolean matches(Context context,
                       boolean setPosition)
                throws SAXException
Parameters:
context - the Context object
setPosition - true if the context position (Context.position) should be set in case the event stack matches the pattern in match.
Returns:
true if the current event stack matches the pattern of this template
Throws:
SAXParseException - if an error occured while evaluating the match expression
SAXException

split

public TemplateFactory.Instance split()
                               throws SAXException
Splits a match pattern that is a union into several template instances. The match pattern of the object itself loses one union.

Returns:
a template Instance object without a union in its match pattern or null
Throws:
SAXException

getPriority

public double getPriority()
Returns:
the priority of this template

getMatchPattern

public Tree getMatchPattern()
Returns:
the match pattern

compareTo

public int compareTo(Object o)
Compares two templates according to their inverse priorities. This results in a descending natural order with java.util.Arrays.sort()

Specified by:
compareTo in interface Comparable

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 TemplateBase
Parameters:
copy - the created clones
copies - the map of already copied objects

toString

public String toString()
Overrides:
toString in class NodeBase