Package org.h2.bnf

Class RuleElement

  • All Implemented Interfaces:
    Rule

    public class RuleElement
    extends java.lang.Object
    implements Rule
    A single terminal rule in a BNF object.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean keyword  
      private Rule link  
      private java.lang.String name  
      private int type  
    • Constructor Summary

      Constructors 
      Constructor Description
      RuleElement​(java.lang.String name, java.lang.String topic)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(BnfVisitor visitor)
      Call the visit method in the given visitor.
      boolean autoComplete​(Sentence sentence)
      Add the next possible token(s).
      void setLinks​(java.util.HashMap<java.lang.String,​RuleHead> ruleMap)
      Update cross references.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • keyword

        private final boolean keyword
      • name

        private final java.lang.String name
      • link

        private Rule link
      • type

        private final int type
    • Constructor Detail

      • RuleElement

        public RuleElement​(java.lang.String name,
                           java.lang.String topic)
    • Method Detail

      • accept

        public void accept​(BnfVisitor visitor)
        Description copied from interface: Rule
        Call the visit method in the given visitor.
        Specified by:
        accept in interface Rule
        Parameters:
        visitor - the visitor
      • setLinks

        public void setLinks​(java.util.HashMap<java.lang.String,​RuleHead> ruleMap)
        Description copied from interface: Rule
        Update cross references.
        Specified by:
        setLinks in interface Rule
        Parameters:
        ruleMap - the reference map
      • autoComplete

        public boolean autoComplete​(Sentence sentence)
        Description copied from interface: Rule
        Add the next possible token(s). If there was a match, the query in the sentence is updated (the matched token is removed).
        Specified by:
        autoComplete in interface Rule
        Parameters:
        sentence - the sentence context
        Returns:
        true if a full match
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object