Class Subrule


  • public class Subrule
    extends TreeNode
    A subrule is a rule name contained in a variant.
    • Constructor Summary

      Constructors 
      Constructor Description
      Subrule​(java.lang.String name)
      Constructs the subrule with an unspecified length.
      Subrule​(java.lang.String name, java.lang.Integer length, Pattern prePattern)
      Constructs the subrule with the specified length and pre-pattern.
      Subrule​(java.lang.String name, Pattern prePattern)
      Constructs the subrule with the specified pre-pattern.
    • Constructor Detail

      • Subrule

        public Subrule​(java.lang.String name)
        Constructs the subrule with an unspecified length. Can be located only at the end of a variant.
        Parameters:
        name - the subrule name
      • Subrule

        public Subrule​(java.lang.String name,
                       Pattern prePattern)
        Constructs the subrule with the specified pre-pattern. Can be located only at the end of a variant.
        Parameters:
        name - the subrule name
        prePattern - the forward pattern information
      • Subrule

        public Subrule​(java.lang.String name,
                       java.lang.Integer length,
                       Pattern prePattern)
        Constructs the subrule with the specified length and pre-pattern.
        Parameters:
        name - the subrule name
        length - the subrule length
        prePattern - the forward pattern information
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the subrule name, as obtained from the input.
        Returns:
        the subrule name
      • getStart

        public java.lang.Integer getStart()
        Returns the starting offset relative to the variant start. The result is null if it is not yet determined.
        Returns:
        the starting offset, in bits
      • setStart

        public void setStart​(int start)
        Sets the starting offset relative to the variant start.
        Parameters:
        start - the starting offset, in bits
      • getLength

        public java.lang.Integer getLength()
        Returns the subrule length. The result is null for a rule with an unspecified length.
        Returns:
        the length in bits
      • getRule

        public Rule getRule()
        Returns the rule to which this subrule refers. The result is null if the name was not yet resolved or the subrule does not refer to any rule.
        Returns:
        the rule object or null
      • getPrePattern

        public Pattern getPrePattern()
        Returns the forward pattern information.
        Returns:
        the pre-pattern
      • setRule

        public Subrule setRule​(Rule rule)
        Specifies to which rule this subrule refers. Used during name resolution.
        Parameters:
        rule - the rule object
        Returns:
        this
      • getFieldName

        public java.lang.String getFieldName()
        Returns the field name which should be generated for this subrule.
        Returns:
        the field name
      • toString

        public java.lang.String toString()
        Returns a string representation of the object containing the rule name and optionally start and length.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object