KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > h2 > bnf > Sentence


1 /*
2  * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
3  * Initial Developer: H2 Group
4  */

5 package org.h2.bnf;
6
7 import java.util.HashMap JavaDoc;
8 import java.util.HashSet JavaDoc;
9
10 import org.h2.server.web.DbTableOrView;
11
12 public class Sentence {
13     public static final int CONTEXT=0, KEYWORD=1;
14     public static final int FUNCTION = 2;
15     public String JavaDoc text;
16     HashMap JavaDoc next;
17     long max;
18     DbTableOrView lastTable;
19     private HashSet JavaDoc tables;
20     private HashMap JavaDoc aliases;
21     
22     public boolean stop() {
23         return System.currentTimeMillis() > max;
24     }
25
26     public void add(String JavaDoc n, String JavaDoc string, int type) {
27         next.put(type+"#"+n, string);
28     }
29     
30     public void addAlias(String JavaDoc alias, DbTableOrView table) {
31         if(aliases == null) {
32             aliases = new HashMap JavaDoc();
33         }
34         aliases.put(alias, table);
35     }
36
37     public void addTable(DbTableOrView table) {
38         lastTable = table;
39         if(tables==null) {
40             tables = new HashSet JavaDoc();
41         }
42         tables.add(table);
43     }
44     
45     public HashSet JavaDoc getTables() {
46         return tables;
47     }
48     
49     public HashMap JavaDoc getAliases() {
50         return aliases;
51     }
52
53     public DbTableOrView getLastTable() {
54         return lastTable;
55     }
56 }
57
Popular Tags