| 
 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectnet.sf.saxon.trans.Mode
public class Mode
A Mode is a collection of rules; the selection of a rule to apply to a given element is determined by a Pattern.
| Field Summary | |
|---|---|
| static StructuredQName | ALL_MODES | 
| static int | DEFAULT_MODE | 
| static StructuredQName | DEFAULT_MODE_NAME | 
| static int | NAMED_MODE | 
| static int | STRIPPER_MODE | 
| Constructor Summary | |
|---|---|
| Mode(int usage,
     StructuredQName modeName)Default constructor - creates a Mode containing no rules | |
| Mode(Mode omniMode,
     StructuredQName modeName)Construct a new Mode, copying the contents of an existing Mode | |
| Method Summary | |
|---|---|
|  void | addRule(Pattern pattern,
        RuleTarget action,
        int precedence,
        double priority,
        boolean explicitMode)Add a rule to the Mode. | 
|  void | allocatePatternSlots(int slots)Specify how many slots for local variables are required by a particular pattern | 
|  void | computeRankings()Compute a rank for each rule, as a combination of the precedence and priority, to allow rapid comparison. | 
|  void | explainTemplateRules(ExpressionPresenter presenter)Explain all template rules in this mode by showing their expression tree represented in XML. | 
|  StructuredQName | getModeName()Get the name of the mode (for diagnostics only) | 
|  Rule | getNextMatchRule(NodeInfo node,
                 Rule currentRule,
                 XPathContext context)Get the rule corresponding to a given Node, by finding the next-best Pattern match after the specified object. | 
|  int | getRecoveryPolicy()Get the policy for handling recoverable errors. | 
|  Rule | getRule(NodeInfo node,
        int min,
        int max,
        XPathContext context)Get the rule corresponding to a given Node, by finding the best Pattern match, subject to a minimum and maximum precedence. | 
|  Rule | getRule(NodeInfo node,
        XPathContext context)Get the rule corresponding to a given Node, by finding the best Pattern match. | 
|  Rule | getRule(NodeInfo node,
        XPathContext context,
        net.sf.saxon.trans.Mode.RuleFilter filter)Get the rule corresponding to a given Node, by finding the best Pattern match. | 
|  void | invertStreamableTemplates(Optimizer opt)For a streamable mode, invert all the templates to generate streamable code | 
|  boolean | isDefaultMode()Determine if this is the default mode | 
|  boolean | isEmpty()Ask whether there are any template rules in this mode (a mode could exist merely because it is referenced in apply-templates) | 
|  boolean | isStreamable()Ask whether this mode is streamable | 
|  void | processRules(net.sf.saxon.trans.Mode.RuleAction action)Walk over all the rules, applying a specified action to each one. | 
|  void | setRecoveryPolicy(int policy)Set the policy for handling recoverable errrors. | 
|  void | setStreamable(boolean streamable)Say that this mode is (or is not) streamable | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int DEFAULT_MODE
public static final int NAMED_MODE
public static final int STRIPPER_MODE
public static final StructuredQName ALL_MODES
public static final StructuredQName DEFAULT_MODE_NAME
| Constructor Detail | 
|---|
public Mode(int usage,
            StructuredQName modeName)
usage - one of DEFAULT_MODE, NAMED_MODE, STRIPPER_MODEmodeName - the name of the mode
public Mode(Mode omniMode,
            StructuredQName modeName)
omniMode - the existing mode. May be null, in which case it is not copiedmodeName - the name of the new mode to be created| Method Detail | 
|---|
public boolean isDefaultMode()
public StructuredQName getModeName()
public boolean isEmpty()
public void setRecoveryPolicy(int policy)
policy - the recovery policy to be used. The options are Configuration.RECOVER_SILENTLY,
 Configuration.RECOVER_WITH_WARNINGS, or Configuration.DO_NOT_RECOVER.public int getRecoveryPolicy()
public void setStreamable(boolean streamable)
                   throws XPathException
streamable - true if this mode is a streamable mode
XPathExceptionpublic boolean isStreamable()
public void addRule(Pattern pattern,
                    RuleTarget action,
                    int precedence,
                    double priority,
                    boolean explicitMode)
pattern - a Patternaction - the Object to return from getRule() when the supplied node matches this Patternprecedence - the import precedence of the rulepriority - the explicit or implicit priority of the ruleexplicitMode - true if adding a template rule for a specific (default or named) mode;
      false if adding a rule because it applies to all modespublic void allocatePatternSlots(int slots)
slots - the number of slots needed
public Rule getRule(NodeInfo node,
                    XPathContext context)
             throws XPathException
node - the NodeInfo referring to the node to be matchedcontext - the XPath dynamic evaluation context
XPathException
public Rule getRule(NodeInfo node,
                    XPathContext context,
                    net.sf.saxon.trans.Mode.RuleFilter filter)
             throws XPathException
node - the NodeInfo referring to the node to be matchedcontext - the XPath dynamic evaluation context
XPathException
public Rule getRule(NodeInfo node,
                    int min,
                    int max,
                    XPathContext context)
             throws XPathException
node - the NodeInfo referring to the node to be matchedmin - the minimum import precedencemax - the maximum import precedencecontext - the XPath dynamic evaluation context
XPathException
public Rule getNextMatchRule(NodeInfo node,
                             Rule currentRule,
                             XPathContext context)
                      throws XPathException
node - the NodeInfo referring to the node to be matchedcurrentRule - the current rule; we are looking for the next match after the current rulecontext - the XPath dynamic evaluation context
XPathException
public void processRules(net.sf.saxon.trans.Mode.RuleAction action)
                  throws XPathException
action - an action that is to be applied to all the rules in this Mode
XPathException
public void invertStreamableTemplates(Optimizer opt)
                               throws XPathException
XPathExceptionpublic void explainTemplateRules(ExpressionPresenter presenter)
presenter - used to display the expression tree
public void computeRankings()
                     throws XPathException
XPathException| 
 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||