org.h2.bnf
Class Sentence

java.lang.Object
  extended by org.h2.bnf.Sentence

public class Sentence
extends java.lang.Object

A query context object. It contains the list of table and alias objects. Used for autocomplete.


Field Summary
static int CONTEXT
          This token type means the possible choices of the item depend on the context.
 
Constructor Summary
Sentence()
           
 
Method Summary
 void add(java.lang.String n, java.lang.String string, int type)
          Add a word to the set of next tokens.
 void addAlias(java.lang.String alias, DbTableOrView table)
          Add an alias name and object
 void addTable(DbTableOrView table)
          Add a table.
 java.util.HashMap<java.lang.String,DbTableOrView> getAliases()
          Get the alias map.
 DbSchema getLastMatchedSchema()
          Get the last matched schema if the last match was a schema.
 DbTableOrView getLastMatchedTable()
          Get the last matched table if the last match was a table.
 DbTableOrView getLastTable()
          Get the last added table.
 java.util.HashMap<java.lang.String,java.lang.String> getNext()
          Get the map of next tokens.
 java.lang.String getQuery()
          Get the query string.
 java.lang.String getQueryUpper()
          Get the uppercase version of the query string.
 java.util.HashSet<DbTableOrView> getTables()
          Get the set of tables.
 void setLastMatchedSchema(DbSchema schema)
          Set the last matched schema if the last match was a schema, or null if it was not.
 void setLastMatchedTable(DbTableOrView table)
          Set the last matched table if the last match was a table.
 void setQuery(java.lang.String query)
          Set the query string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT

public static final int CONTEXT
This token type means the possible choices of the item depend on the context. For example the item represents a table name of the current database.

See Also:
Constant Field Values
Constructor Detail

Sentence

public Sentence()
Method Detail

add

public void add(java.lang.String n,
                java.lang.String string,
                int type)
Add a word to the set of next tokens.

Parameters:
n - the token name
string - an example text
type - the token type

addAlias

public void addAlias(java.lang.String alias,
                     DbTableOrView table)
Add an alias name and object

Parameters:
alias - the alias name
table - the alias table

addTable

public void addTable(DbTableOrView table)
Add a table.

Parameters:
table - the table

getTables

public java.util.HashSet<DbTableOrView> getTables()
Get the set of tables.

Returns:
the set of tables

getAliases

public java.util.HashMap<java.lang.String,DbTableOrView> getAliases()
Get the alias map.

Returns:
the alias map

getLastTable

public DbTableOrView getLastTable()
Get the last added table.

Returns:
the last table

getLastMatchedSchema

public DbSchema getLastMatchedSchema()
Get the last matched schema if the last match was a schema.

Returns:
the last schema or null

setLastMatchedSchema

public void setLastMatchedSchema(DbSchema schema)
Set the last matched schema if the last match was a schema, or null if it was not.

Parameters:
schema - the last matched schema or null

setLastMatchedTable

public void setLastMatchedTable(DbTableOrView table)
Set the last matched table if the last match was a table.

Parameters:
table - the last matched table or null

getLastMatchedTable

public DbTableOrView getLastMatchedTable()
Get the last matched table if the last match was a table.

Returns:
the last table or null

setQuery

public void setQuery(java.lang.String query)
Set the query string.

Parameters:
query - the query string

getQuery

public java.lang.String getQuery()
Get the query string.

Returns:
the query

getQueryUpper

public java.lang.String getQueryUpper()
Get the uppercase version of the query string.

Returns:
the uppercase query

getNext

public java.util.HashMap<java.lang.String,java.lang.String> getNext()
Get the map of next tokens.

Returns:
the next token map