KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dql > plan > table > OrderSequencePlan


1 package com.daffodilwoods.daffodildb.server.sql99.dql.plan.table;
2
3 import com.daffodilwoods.daffodildb.client.*;
4 import com.daffodilwoods.daffodildb.server.sql99.common.*;
5 import com.daffodilwoods.daffodildb.server.sql99.dql.common.*;
6 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.*;
7 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
8 import com.daffodilwoods.database.resource.*;
9 import com.daffodilwoods.database.sqlinitiator.*;
10
11 /**
12  * It represents unexecutable plan. It is used to maintain the sequence of plan
13  * on which order is shifted. When order is shifted to more than one table,
14  * then we need the same sequence of table in resultset in which order is
15  * shifted to table.
16  * <p>Title: </p>
17  * <p>Description: </p>
18  * <p>Copyright: Copyright (c) 2003</p>
19  * <p>Company: </p>
20  * @author unascribed
21  * @version 1.0
22  */

23
24 public class OrderSequencePlan extends OrderTablePlanAbstract {
25
26    public OrderSequencePlan(_TablePlan[] childPlans0) {
27       childPlans = childPlans0;
28    }
29
30    /**
31     * Returns the type of the plan.
32     * @return
33     * @throws DException
34     */

35
36    public int getType() throws DException {
37       return TableExpressionConstants.ORDERSEQUENCEPLAN;
38    }
39
40    /**
41     * Sets the plan on which order is shifted.
42     * @param childPlans0
43     */

44
45    public void setPlans(_TablePlan childPlans0[]) {
46       this.childPlans = childPlans0;
47    }
48
49    public String JavaDoc toString() {
50       StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
51       stringBuffer.append("OrderSequencePlan[");
52       for (int i = 0; i < childPlans.length; i++) {
53          stringBuffer.append("[");
54          stringBuffer.append(childPlans[i].toString());
55          stringBuffer.append("]");
56       }
57       stringBuffer.append("]");
58       return stringBuffer.toString();
59    }
60
61    public String JavaDoc getVerifier() throws DException {
62       StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
63       stringBuffer.append("OrderSequencePlan[");
64       for (int i = 0; i < childPlans.length; i++) {
65          stringBuffer.append("[");
66          stringBuffer.append(childPlans[i].toString());
67          stringBuffer.append("]");
68       }
69       stringBuffer.append("]");
70       return stringBuffer.toString();
71    }
72
73    /**
74     * Returns the plan for OrderSequence.
75     * @return
76     * @throws DException
77     */

78
79    public _QueryPlan getQueryPlan() throws DException {
80       int length = childPlans.length;
81       _QueryPlan[] cplans = new _QueryPlan[length];
82       for (int i = 0; i < length; i++) {
83          cplans[i] = childPlans[i].getQueryPlan();
84       }
85       return new QueryPlan("OrderSequencePlan", cplans, null, null);
86    }
87
88    /**
89     * Returns the underlying plans.
90     * @return
91     * @throws DException
92     */

93
94    public _TablePlan[] getChildTablePlans() throws DException {
95       return new _TablePlan[] {this};
96    }
97
98    /**
99     * Returns the joint order of underlying plan.
100     * @return
101     * @throws DException
102     */

103
104    public _Order getOrder() throws DException {
105       SelectOrder selectOrder = null;
106       for (int i = 0, length = childPlans.length; i < length; ++i) {
107          _Order order = childPlans[i].getOrder();
108          selectOrder = (SelectOrder) GeneralPurposeStaticClass.getJoinOrdered(selectOrder, order);
109       }
110       return selectOrder;
111    }
112
113 }
114
Popular Tags