Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.xsl.process
Class RuleCollection

    java.lang.Object
      com.novell.xsl.process.RuleCollection

    public class RuleCollection

extends Object

A collection of rules organized for pattern matching.

The collection automatically optimizes its internal storage before doing any matching. This optimization may be time consuming for a large collections, so there is a method available to force the optimization to happen up front.

Constructor Summary
`RuleCollection()` Constructs an empty rule collection.

Method Summary
`void` | `add(Rule rule)` Adds the specified rule to this collection.
`void` | `dump(PrintWriter out, int indent)` Dumps this object to the specified output stream.
`Rule` | `findMatchingImportedRule(Node source, ProcessingEnv env, Rule currentRule)` Optimizes this rule collection for matching (if it isn't already optimized) and returns the rule that matches the specified source node and the specified mode, looking only at rules that were imported into the stylesheet containing the current rule.
`Rule` | `findMatchingRule(Node source, ProcessingEnv env, Mode mode)` Optimizes this rule collection for matching (if it isn't already optimized) and returns the rule that matches the specified source node and the specified mode.
`Rule` | `getNamedRule(ExpandedQName name)` Return a rule by name, if there is a matching rule.
`void` | `optimize()` Optimizes this rule collection for matching.
`void` | `setBuiltIn(Rule rule, int nodeType)` Sets the specified rule as this collection's built-in rule for nodes of the specified type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RuleCollection

    public RuleCollection()

  Constructs an empty rule collection.

Method Detail

### add

    public void add(Rule rule)

  Adds the specified rule to this collection. This method causes this rule collection to become unoptimized.

  Note: Rule collections cannot handle rules whose `getTargetType` method returns `FilterExpr.OTHER_TARGET`. Such rules should never occur in XSL.

  Parameters:
    `rule` - the rule to be added
  Throws:
    `IllegalArgumentException` - if the rule's target type is `FilterExpr.OTHER_TARGET`

### setBuiltIn

    public void setBuiltIn(Rule rule,
                           int nodeType)

  Sets the specified rule as this collection's built-in rule for nodes of the specified type. Built-in rules are considered to have lower importance that any other rule, and match regardless of mode. This method causes this rule collection to become unoptimized.

  Parameters:
    `rule` - the built-in rule to be added
    `nodeType` - the node type that the built-in rule is for

### findMatchingRule

    public Rule findMatchingRule(Node source,
                                 ProcessingEnv env,
                                 Mode mode)
                          throws XSLException

  Optimizes this rule collection for matching (if it isn't already optimized) and returns the rule that matches the specified source node and the specified mode.

  Parameters:
    `source` - the source node to be matched
    `env` - the XSLT processing environment
    `mode` - the mode to be matched
  Returns:
    the matching rule, or `null` if no rule matches
  Throws:
    `XSLException` - if a fatal error occurs during evaluation

### findMatchingImportedRule

    public Rule findMatchingImportedRule(Node source,
                                         ProcessingEnv env,
                                         Rule currentRule)
                                  throws XSLException

  Optimizes this rule collection for matching (if it isn't already optimized) and returns the rule that matches the specified source node and the specified mode, looking only at rules that were imported into the stylesheet containing the current rule.

  Parameters:
    `source` - the source node to be matched
    `env` - the XSLT processing environment
    `currentRule` - the current template rule
  Returns:
    the matching rule, or `null` if no rule matches
  Throws:
    `XSLException` - if a fatal error occurs during evaluation

### getNamedRule

    public Rule getNamedRule(ExpandedQName name)

  Return a rule by name, if there is a matching rule.

  Parameters:
    `name` - The expanded name of the rule to return.
  Returns:
    A Rule or null.

### optimize

    public void optimize()

  Optimizes this rule collection for matching.

### dump

    public void dump(PrintWriter out,
                     int indent)

  Dumps this object to the specified output stream.

  Parameters:
    `out` - the output stream to write to
    `indent` - the number of tabs to indent

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD