Class ParseRule

    • Constructor Detail

      • ParseRule

        public ParseRule()
        Creates a new parse rule.
      • ParseRule

        public ParseRule​(java.lang.String aName)
        Creates a new parse rule for given name
      • ParseRule

        public ParseRule​(java.lang.String aName,
                         java.lang.String aPattern)
        Creates a new parse rule for given name
      • ParseRule

        public ParseRule​(java.lang.String aName,
                         ParseRule... theRules)
        Creates a new parse rule for given name
      • ParseRule

        public ParseRule​(java.lang.String aName,
                         ParseHandler aHandler)
        Creates a new parse rule for given name and handler.
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns rule name.
      • setName

        public void setName​(java.lang.String aName)
        Sets rule name.
      • getPattern

        public java.lang.String getPattern()
        Returns the rule pattern if simple pattern.
      • setPattern

        public ParseRule setPattern​(java.lang.String anPattern)
        Sets the rule pattern if simple pattern.
      • isLiteral

        public boolean isLiteral()
        Returns whether pattern is literal.
      • setLiteral

        public ParseRule setLiteral​(boolean aFlag)
        Sets whether pattern is literal.
      • getPatternCompiled

        public java.util.regex.Pattern getPatternCompiled()
        Returns the pattern compiled.
      • getPatternCompileFlags

        public int getPatternCompileFlags()
        Returns pattern compile flags.
      • isAnonymous

        public boolean isAnonymous()
        Returns whether rule is anonymous - true if rule has no name and no pattern.
      • getHandler

        public ParseHandler getHandler()
        Returns the handler for this rule.
      • setHandler

        public void setHandler​(ParseHandler aHandler)
        Sets the handler for this rule.
      • isLookAhead

        public boolean isLookAhead()
        Returns whether rule is look ahead.
      • getLookAhead

        public int getLookAhead()
        Returns the look ahead count.
      • setLookAhead

        public ParseRule setLookAhead​(int aValue)
        Sets the look ahead count.
      • getRuleCount

        public int getRuleCount()
        Returns the number of rules.
      • getRule

        public ParseRule getRule​(int anIndex)
        Returns the individual rule at index.
      • getRuleOp

        public ParseRule.Op getRuleOp​(int anIndex)
        Returns the individual rule op at index.
      • getRuleCount

        public ParseRule.Count getRuleCount​(int anIndex)
        Returns the individual rule count at index.
      • getRules

        public java.util.List<ParseRule> getRules()
        Returns the child rules.
      • getRuleOps

        public java.util.List<ParseRule.Op> getRuleOps()
        Returns the rule ops list.
      • getRuleCounts

        public java.util.List<ParseRule.Count> getRuleCounts()
        Returns the rule counts list.
      • removeRule

        public ParseRule removeRule​(int anIndex)
        Removes a child rule.
      • removeRule

        public int removeRule​(ParseRule aRule)
        Removes a child rule.
      • addRule

        public ParseRule addRule​(java.lang.String aPattern)
        Adds a rule for pattern.
      • addRule

        public ParseRule addRule​(ParseRule.Op anOp,
                                 java.lang.String aPattern)
        Adds a rule for pattern.
      • addRule

        public ParseRule addRule​(java.lang.String aName,
                                 java.lang.String aPattern)
        Adds a rule for name and pattern.
      • addRule

        public ParseRule addRule​(ParseRule.Op anOp,
                                 java.lang.String aName,
                                 java.lang.String aPattern)
        Adds a rule for name and pattern.
      • addRule

        public ParseRule addRule​(ParseRule.Count aCount,
                                 java.lang.String aName,
                                 java.lang.String aPattern)
        Adds a rule for name and pattern.
      • addRules

        public void addRules​(ParseRule... theRules)
        Adds child rules.
      • addLookAhead

        public ParseRule addLookAhead​(int aCount)
        Adds a look ahead rule with given operator and count.
      • addLookAhead

        public ParseRule addLookAhead​(ParseRule.Op anOp,
                                      int aCount)
        Adds a look ahead rule with given operator and count.
      • addLookAhead

        public ParseRule addLookAhead​(ParseRule aRule)
        Adds a look ahead rule with given operator.
      • getRulePathCount

        public int getRulePathCount()
        Returns the number of rule paths.
      • getRulePath

        public java.util.List<ParseRule> getRulePath​(int anIndex)
        Returns the individual rule path at given index.
      • getRulePaths

        public java.util.List<java.util.List<ParseRule>> getRulePaths()
        Returns the rule paths.
      • getRuleCount

        public ParseRule.Count getRuleCount​(int aPathIndex,
                                            int aRuleIndex)
        Returns the rule count for a given rule path and index in that rule path.
      • clone

        @Nullable
        public ParseRule clone()
        Standard clone implementation.
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns a string representation.
        Overrides:
        toString in class java.lang.Object