net.sf.joost.instruction
Class TemplateFactory.Instance
java.lang.Object
net.sf.joost.instruction.AbstractInstruction
net.sf.joost.instruction.NodeBase
net.sf.joost.instruction.TemplateBase
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
Field Summary |
private Tree |
match
The match pattern |
private double |
priority
The priority of this template |
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 |
match
private Tree match
- The match pattern
priority
private double priority
- The priority of this template
TemplateFactory.Instance
protected TemplateFactory.Instance(String qName,
NodeBase parent,
ParseContext context,
Tree match,
double priority,
int visibility,
boolean isPublic,
boolean newScope)
matches
public boolean matches(Context context,
boolean setPosition)
throws SAXException
- Parameters:
context
- the Context objectsetPosition
- 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 clonescopies
- the map of already copied objects
toString
public String toString()
- Overrides:
toString
in class NodeBase