## org.h2.bnf
Interface Rule

All Known Implementing Classes:
  DbContextRule, RuleElement, RuleFixed, RuleList, RuleOptional, RuleRepeat

    public interface Rule

Represents a BNF rule.

Method Summary
`void` `addNextTokenList(Sentence sentence)` Add the next possible token for a query.
`java.lang.String` `getHtmlRailroad(Bnf config, boolean topLevel)` Get the HTML railroad.
`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.

Method Detail

### name

    java.lang.String name()

  Get the name of the rule.

  Returns:
    the name

### random

    java.lang.String random(Bnf config,
                            int level)

  Get a random entry.

  Parameters:
    `config` - the configuration
    `level` - the call level
  Returns:
    the entry

### last

    Rule last()

  Get the last entry.

  Returns:
    the last entry

### setLinks

    void setLinks(java.util.HashMap<java.lang.String,RuleHead> ruleMap)

  Update cross references.

  Parameters:
    `ruleMap` - the reference map

### addNextTokenList

    void addNextTokenList(Sentence sentence)

  Add the next possible token for a query. Used for autocomplete support.

  Parameters:
    `sentence` - the sentence context

### matchRemove

    boolean matchRemove(Sentence sentence)

  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).

  Parameters:
    `sentence` - the sentence context
  Returns:
    false if not a match or a partial match, true if a full match

### getHtmlRailroad

    java.lang.String getHtmlRailroad(Bnf config,
                                     boolean topLevel)

  Get the HTML railroad.

  Parameters:
    `config` - the configuration
    `topLevel` - true if line break are permitted
  Returns:
    the railroad