Top Description Fields Constructors Methods
org.h2.bnf

public Class Sentence

extends Object
Class Inheritance
Imports
java.util.HashMap, .HashSet, .Objects, org.h2.bnf.context.DbSchema, .DbTableOrView, org.h2.util.StringUtils

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

Field Summary

Modifier and TypeField and Description
private HashMap<String, DbTableOrView>
public static final int
CONTEXT

This token type means the possible choices of the item depend on the context.

public static final int
FUNCTION

The token type for a function name.

public static final int
KEYWORD

The token type for a keyword.

private DbSchema
private DbTableOrView
private DbTableOrView
private static final int
private final HashMap<String, String>
next

The map of next tokens in the form type#tokenName token.

private String
query

The complete query string.

private String
queryUpper

The uppercase version of the query string.

private long
private HashSet<DbTableOrView>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(String
the token name
n
,
String
an example text
string
,
int
the token type
type
)

Add a word to the set of next tokens.

public void
addAlias(String
the alias name
alias
,
DbTableOrView
the alias table
table
)

Add an alias name and object

public void
addTable(DbTableOrView
the table
table
)

Add a table.

public HashMap<String, DbTableOrView>

Returns:

the alias map
getAliases
()

Get the alias map.

public DbSchema

Returns:

the last schema or null
getLastMatchedSchema
()

Get the last matched schema if the last match was a schema.

public DbTableOrView

Returns:

the last table or null
getLastMatchedTable
()

Get the last matched table if the last match was a table.

public DbTableOrView

Returns:

the last table
getLastTable
()

Get the last added table.

public HashMap<String, String>

Returns:

the next token map
getNext
()

Get the map of next tokens.

public String

Returns:

the query
getQuery
()

Get the query string.

public String

Returns:

the uppercase query
getQueryUpper
()

Get the uppercase version of the query string.

public HashSet<DbTableOrView>

Returns:

the set of tables
getTables
()

Get the set of tables.

public void
setLastMatchedSchema(DbSchema
the last matched schema or null
schema
)

Set the last matched schema if the last match was a schema, or null if it was not.

public void
setLastMatchedTable(DbTableOrView
the last matched table or null
table
)

Set the last matched table if the last match was a table.

public void
setQuery(String
the query string
query
)

Set the query string.

public void
start()

Start the timer to make sure processing doesn't take too long.

public void
stopIfRequired()

Check if it's time to stop processing.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasesback to summary
private HashMap<String, DbTableOrView> aliases
CONTEXTback to summary
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.

FUNCTIONback to summary
public static final int FUNCTION

The token type for a function name.

KEYWORDback to summary
public static final int KEYWORD

The token type for a keyword.

lastMatchedSchemaback to summary
private DbSchema lastMatchedSchema
lastMatchedTableback to summary
private DbTableOrView lastMatchedTable
lastTableback to summary
private DbTableOrView lastTable
MAX_PROCESSING_TIMEback to summary
private static final int MAX_PROCESSING_TIME
nextback to summary
private final HashMap<String, String> next

The map of next tokens in the form type#tokenName token.

queryback to summary
private String query

The complete query string.

queryUpperback to summary
private String queryUpper

The uppercase version of the query string.

stopAtNsback to summary
private long stopAtNs
tablesback to summary
private HashSet<DbTableOrView> tables

Constructor Detail

Sentenceback to summary
public Sentence()

Method Detail

addback to summary
public void add(String n, String string, int type)

Add a word to the set of next tokens.

Parameters
n:String

the token name

string:String

an example text

type:int

the token type

addAliasback to summary
public void addAlias(String alias, DbTableOrView table)

Add an alias name and object

Parameters
alias:String

the alias name

table:DbTableOrView

the alias table

addTableback to summary
public void addTable(DbTableOrView table)

Add a table.

Parameters
table:DbTableOrView

the table

getAliasesback to summary
public HashMap<String, DbTableOrView> getAliases()

Get the alias map.

Returns:HashMap<String, DbTableOrView>

the alias map

getLastMatchedSchemaback to summary
public DbSchema getLastMatchedSchema()

Get the last matched schema if the last match was a schema.

Returns:DbSchema

the last schema or null

getLastMatchedTableback to summary
public DbTableOrView getLastMatchedTable()

Get the last matched table if the last match was a table.

Returns:DbTableOrView

the last table or null

getLastTableback to summary
public DbTableOrView getLastTable()

Get the last added table.

Returns:DbTableOrView

the last table

getNextback to summary
public HashMap<String, String> getNext()

Get the map of next tokens.

Returns:HashMap<String, String>

the next token map

getQueryback to summary
public String getQuery()

Get the query string.

Returns:String

the query

getQueryUpperback to summary
public String getQueryUpper()

Get the uppercase version of the query string.

Returns:String

the uppercase query

getTablesback to summary
public HashSet<DbTableOrView> getTables()

Get the set of tables.

Returns:HashSet<DbTableOrView>

the set of tables

setLastMatchedSchemaback to summary
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:DbSchema

the last matched schema or null

setLastMatchedTableback to summary
public void setLastMatchedTable(DbTableOrView table)

Set the last matched table if the last match was a table.

Parameters
table:DbTableOrView

the last matched table or null

setQueryback to summary
public void setQuery(String query)

Set the query string.

Parameters
query:String

the query string

startback to summary
public void start()

Start the timer to make sure processing doesn't take too long.

stopIfRequiredback to summary
public void stopIfRequired()

Check if it's time to stop processing. Processing auto-complete shouldn't take more than a few milliseconds. If processing is stopped, this methods throws an IllegalStateException