Class Mode


  • public class Mode
    extends java.lang.Object

    Mode manages a number of RuleSet instances for the mode in a stylesheet. It is responsible for finding the correct rule for a given DOM4J Node using the XSLT processing model uses the smallest possible RuleSet to reduce the number of Rule evaluations.

    • Constructor Detail

      • Mode

        public Mode()
    • Method Detail

      • fireRule

        public void fireRule​(Node node)
                      throws java.lang.Exception
        Runs the actions associated with the given node
        Parameters:
        node - DOCUMENT ME!
        Throws:
        java.lang.Exception - DOCUMENT ME!
      • applyTemplates

        public void applyTemplates​(Element element)
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • applyTemplates

        public void applyTemplates​(Document document)
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addRule

        public void addRule​(Rule rule)
      • removeRule

        public void removeRule​(Rule rule)
      • getMatchingRule

        public Rule getMatchingRule​(Node node)
        Performs an XSLT processing model match for the rule which matches the given Node the best.
        Parameters:
        node - is the DOM4J Node to match against
        Returns:
        the matching Rule or no rule if none matched
      • getRuleSet

        protected RuleSet getRuleSet​(int matchType)
        DOCUMENT ME!
        Parameters:
        matchType - DOCUMENT ME!
        Returns:
        the RuleSet for the given matching type. This method will never return null, a new instance will be created.
      • addToNameMap

        protected java.util.Map<java.lang.String,​RuleSet> addToNameMap​(java.util.Map<java.lang.String,​RuleSet> map,
                                                                             java.lang.String name,
                                                                             Rule rule)
        Adds the Rule to a RuleSet for the given name.
        Parameters:
        map - DOCUMENT ME!
        name - DOCUMENT ME!
        rule - DOCUMENT ME!
        Returns:
        the Map (which will be created if the given map was null
      • removeFromNameMap

        protected void removeFromNameMap​(java.util.Map<java.lang.String,​RuleSet> map,
                                         java.lang.String name,
                                         Rule rule)