org.h2.bnf
Class RuleOptional

java.lang.Object
  extended by org.h2.bnf.RuleOptional
All Implemented Interfaces:
Rule

public class RuleOptional
extends java.lang.Object
implements Rule

Represents an optional BNF rule.


Method Summary
 void accept(BnfVisitor visitor)
          Call the visit method in the given visitor.
 void addNextTokenList(Sentence sentence)
          Add the next possible token for a query.
 boolean matchRemove(Sentence sentence)
          Remove a token from a sentence.
 java.lang.String name()
          Get the name of the rule.
 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
 

Method Detail

toString

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

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

name

public java.lang.String name()
Description copied from interface: Rule
Get the name of the rule.

Specified by:
name in interface Rule
Returns:
the name

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

matchRemove

public boolean matchRemove(Sentence sentence)
Description copied from interface: Rule
Remove a token from a sentence. Used for autocomplete support. If there was a match, the query in the sentence is updated (the matched token is removed).

Specified by:
matchRemove in interface Rule
Parameters:
sentence - the sentence context
Returns:
false if not a match or a partial match, true if a full match

addNextTokenList

public void addNextTokenList(Sentence sentence)
Description copied from interface: Rule
Add the next possible token for a query. Used for autocomplete support.

Specified by:
addNextTokenList in interface Rule
Parameters:
sentence - the sentence context