net.sf.saxon.trans

Class Rule

public final class Rule extends Object implements Serializable

Rule: a template rule, or a strip-space rule used to support the implementation
Constructor Summary
Rule(Pattern p, RuleTarget o, int prec, double prio, int seq)
Create a Rule.
Rule(Rule r)
Copy a rule, including the chain of rules linked to it
Method Summary
intcompareComputedRank(Rule other)
Rules have an ordering, based on their precedence and priority.
intcompareRank(Rule other)
Rules have an ordering, based on their precedence and priority.
RuleTargetgetAction()
RulegetNext()
PatterngetPattern()
intgetPrecedence()
doublegetPriority()
intgetRank()
intgetSequence()
booleanisAlwaysMatches()
voidsetAction(RuleTarget action)
voidsetAlwaysMatches(boolean matches)
voidsetNext(Rule next)
voidsetRank(int rank)

Constructor Detail

Rule

public Rule(Pattern p, RuleTarget o, int prec, double prio, int seq)
Create a Rule.

Parameters: p the pattern that this rule matches o the object invoked by this rule (usually a Template) prec the precedence of the rule prio the priority of the rule seq a sequence number for ordering of rules

Rule

public Rule(Rule r)
Copy a rule, including the chain of rules linked to it

Parameters: r the rule to be copied

Method Detail

compareComputedRank

public int compareComputedRank(Rule other)
Rules have an ordering, based on their precedence and priority.

Parameters: other Another rule whose ordering rank is to be compared with this one

Returns: <0 if this rule has lower rank, that is if it has lower precedence or equal precedence and lower priority. 0 if the two rules have equal precedence and priority. >0 if this rule has higher rank in precedence/priority order

compareRank

public int compareRank(Rule other)
Rules have an ordering, based on their precedence and priority. This method compares them using the precomputed rank value.

Parameters: other Another rule whose ordering rank is to be compared with this one

Returns: <0 if this rule has lower rank, that is if it has lower precedence or equal precedence and lower priority. 0 if the two rules have equal precedence and priority. >0 if this rule has higher rank in precedence/priority order

getAction

public RuleTarget getAction()

getNext

public Rule getNext()

getPattern

public Pattern getPattern()

getPrecedence

public int getPrecedence()

getPriority

public double getPriority()

getRank

public int getRank()

getSequence

public int getSequence()

isAlwaysMatches

public boolean isAlwaysMatches()

setAction

public void setAction(RuleTarget action)

setAlwaysMatches

public void setAlwaysMatches(boolean matches)

setNext

public void setNext(Rule next)

setRank

public void setRank(int rank)