KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > database > QueryPlanNode


1 /**
2  * com.mckoi.database.QueryPlanNode 06 Nov 2001
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * Version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License Version 2 for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * Version 2 along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * Change Log:
21  *
22  *
23  */

24
25 package com.mckoi.database;
26
27 import java.util.ArrayList JavaDoc;
28
29 /**
30  * A node element of a query plan tree. A plan of a query is represented as
31  * a tree structure of such nodes. The design allows for plan nodes to be
32  * easily reorganised for the construction of better plans.
33  *
34  * @author Tobias Downer
35  */

36
37 public interface QueryPlanNode extends java.io.Serializable JavaDoc, Cloneable JavaDoc {
38
39   /**
40    * Evaluates the node and returns the result as a Table. The
41    * VariableResolver resolves any outer variables
42    */

43   Table evaluate(QueryContext context);
44
45   /**
46    * Discovers a list of TableName that represent the sources that this query
47    * requires to complete itself. For example, if this is a query plan of
48    * two joined table, the fully resolved names of both tables are returned.
49    * <p>
50    * The resultant list will not contain the same table name more than once.
51    * The resultant list contains TableName objects.
52    * <p>
53    * NOTE, if a table is aliased, the unaliased name is returned.
54    */

55   ArrayList JavaDoc discoverTableNames(ArrayList JavaDoc list);
56
57   /**
58    * Discovers all the correlated variables in the plan (and plan children)
59    * that reference a particular layer. For example, if we wanted to find
60    * all the CorrelatedVariable objects that reference the current layer, we
61    * would typically call 'discoverCorrelatedVariables(0, new ArrayList())'
62    */

63   ArrayList JavaDoc discoverCorrelatedVariables(int level, ArrayList JavaDoc list);
64
65   /**
66    * Deep clones this query plan.
67    */

68   Object JavaDoc clone() throws CloneNotSupportedException JavaDoc;
69
70   /**
71    * Writes a textural representation of the node to the StringBuffer at the
72    * given indent level.
73    */

74   void debugString(int indent, StringBuffer JavaDoc buf);
75
76 }
77
Popular Tags