Class Rule

java.lang.Object
net.sf.saxon.trans.rules.Rule
Direct Known Subclasses:
RuleEE

public class Rule extends Object
Rule: common functionality representing an abstraction of a template rule, a strip-space rule, or an accumulator rule
  • Field Details Link icon

    • pattern Link icon

      protected Pattern pattern
    • action Link icon

      protected RuleTarget action
    • precedence Link icon

      protected int precedence
    • minImportPrecedence Link icon

      protected int minImportPrecedence
    • priority Link icon

      protected double priority
    • next Link icon

      protected Rule next
    • sequence Link icon

      protected int sequence
    • part Link icon

      protected int part
  • Constructor Details Link icon

    • Rule Link icon

      protected Rule()
    • Rule Link icon

      public Rule(Pattern p, RuleTarget o, int prec, int min, double prio, int seq, int part)
      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
      min - the minumum import precedence for xsl:apply-imports
      prio - the priority of the rule
      seq - a sequence number for ordering of rules
  • Method Details Link icon

    • getSequence Link icon

      public int getSequence()
    • getPartNumber Link icon

      public int getPartNumber()
    • setAction Link icon

      public void setAction(RuleTarget action)
    • getAction Link icon

      public RuleTarget getAction()
    • getNext Link icon

      public Rule getNext()
    • setNext Link icon

      public void setNext(Rule next)
    • getPattern Link icon

      public Pattern getPattern()
    • setPattern Link icon

      public void setPattern(Pattern pattern)
    • getPrecedence Link icon

      public int getPrecedence()
    • getMinImportPrecedence Link icon

      public int getMinImportPrecedence()
    • getPriority Link icon

      public double getPriority()
    • setAlwaysMatches Link icon

      public void setAlwaysMatches(boolean matches)
    • isAlwaysMatches Link icon

      public boolean isAlwaysMatches()
    • setRank Link icon

      public void setRank(int rank)
    • getRank Link icon

      public int getRank()
    • export Link icon

      public void export(ExpressionPresenter out, boolean modeStreamable) throws XPathException
      Export this rule
      Parameters:
      out - the destination for the export
      modeStreamable - if the mode for this rule is streamable (should be EE only?)
      Throws:
      XPathException
    • exportOtherProperties Link icon

      public void exportOtherProperties(ExpressionPresenter out) throws XPathException
      Add other exported properties as required
      Parameters:
      out - the export destination
      Throws:
      XPathException
    • compareRank Link icon

      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
    • compareComputedRank Link icon

      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
    • matches Link icon

      public boolean matches(Item item, XPathContextMajor context) throws XPathException
      Throws:
      XPathException