org.h2.bnf
Class RuleElement

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

public class RuleElement
extends java.lang.Object
implements Rule

A single terminal rule in a BNF object.


Method Summary
 void addNextTokenList(Sentence sentence)
          Add the next possible token for a query.
 Rule last()
          Get the last entry.
 boolean matchRemove(Sentence sentence)
          Remove a token from a sentence.
 java.lang.String name()
          Get the name of the rule.
 java.lang.String random(Bnf config, int level)
          Get a random entry.
 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

random

public java.lang.String random(Bnf config,
                               int level)
Description copied from interface: Rule
Get a random entry.

Specified by:
random in interface Rule
Parameters:
config - the configuration
level - the call level
Returns:
the entry

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

last

public Rule last()
Description copied from interface: Rule
Get the last entry.

Specified by:
last in interface Rule
Returns:
the last entry

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