|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.xsl.process.Rule
An abstract class for rules whose match pattern is a single path expression. Rules whose match pattern is a union of path expressions are represented by multiple instances of this class. Subclasses define what happens once a rule has been successfully matched.
This class implements java.lang.Comparable
to impose a partial ordering on rules based on the XSL conflict resolution
algorithm.
Constructor Summary | |
|
Rule(Pattern pattern,
ExpandedQName name,
Mode mode,
int importance,
Priority priority,
int number,
Node nsContext)
Constructs a new rule. |
protected |
Rule(Rule original,
Pattern pattern)
Constructs a new rule that is (almost) a shallow copy of the specified rule, with the intent of using the new rule as one of the multiple instances representing a union of path expressions. |
Method Summary | |
abstract Rule |
cloneForUnion(Pattern pattern)
An abstract method to create a new rule that is (almost) a shallow copy of this rule and whose actual class is the same as this rule's actual class, with the intent of using the new rule as one of the multiple instances representing a union of path expressions. |
int |
compareTo(Object obj)
Compares this rule with another rule for conflict resolution order. |
abstract void |
dump(PrintWriter out,
int indent)
Dumps this object to the specified output stream. |
int |
getImportance()
Returns this rule's importance. |
Mode |
getMode()
Returns this rule's mode. |
ExpandedQName |
getName()
|
Node |
getNamespaceContext()
Return the node that is the namespace context for this template |
int |
getNumber()
Returns this rule's identifying number. |
Pattern |
getPattern()
Returns this rule's pattern. |
Priority |
getPriority()
Returns this rule's priority. |
protected static void |
indent(PrintWriter writer,
int indent)
Utility function for derived classes. |
boolean |
matches(Node source,
ProcessingEnv env,
Mode mode)
Tests if this rule matches the specified source node and the specified mode. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Rule(Pattern pattern, ExpandedQName name, Mode mode, int importance, Priority priority, int number, Node nsContext)
pattern
- the rule's path expressionname
- the rule's namemode
- the rule's modeimportance
- the rule's importancepriority
- the rule's priority; null
means use the
default priority based on the rule's patternnumber
- the rule's identifying numbernsContext
- The node in the style sheet from which this rule comesprotected Rule(Rule original, Pattern pattern)
original
- the original rulepattern
- the clone's path expression, represented as a chain of
FilterExpr
objectscloneForUnion(com.novell.xsl.pattern.Pattern)
Method Detail |
public abstract Rule cloneForUnion(Pattern pattern)
pattern
- the clone's path expression, represented as a chain of
FilterExpr
objects
public abstract void dump(PrintWriter out, int indent)
out
- the output stream to write toindent
- the number of tabs to indentpublic Pattern getPattern()
public ExpandedQName getName()
public Mode getMode()
public int getImportance()
XSL specifies only that certain rules are "more important" than others. Therefore the actual numeric importance values are strictly an artifact of our implementation.
public Priority getPriority()
public int getNumber()
public int compareTo(Object obj)
compareTo
in interface Comparable
obj
- the other Rule
to compare with; it is declared
as an Object
to conform with the
Comparable
interface
ClassCastException
- if the specified object is not a Rule
public boolean matches(Node source, ProcessingEnv env, Mode mode) throws XSLException
source
- the source node to be testedmode
- the mode to be tested
true
if this rule matches,
false
if it does not
XSLException
- if a fatal error occurs during evaluationpublic Node getNamespaceContext()
protected static void indent(PrintWriter writer, int indent)
writer
- Output device.indent
- Number of tabs to output.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |