KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dql > tableexpression > fromclause > OrderMappingWithTableRefernces


1 package com.daffodilwoods.daffodildb.server.sql99.dql.tableexpression.fromclause;
2
3 import com.daffodilwoods.daffodildb.server.sql99.dql.common.*;
4 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.order.*;
5 import com.daffodilwoods.database.resource.*;
6 import com.daffodilwoods.database.utility.*;
7 import com.daffodilwoods.daffodildb.server.sql99.common.TableDetails;
8 import java.util.ArrayList JavaDoc;
9 import java.util.Arrays JavaDoc;
10
11 /**
12  * It is used to get the single table orders on the basis of order plan passed
13  * to tablereferencelist. It is needed to check whether order passed to
14  * tablereferencelist can be restricted to single table level.
15  * <p>Title: </p>
16  * <p>Description: </p>
17  * <p>Copyright: Copyright (c) 2003</p>
18  * <p>Company: </p>
19  * @author unascribed
20  * @version 1.0
21  */

22
23 public class OrderMappingWithTableRefernces {
24
25    /**
26     * Represents the orders of single table.
27     */

28
29    private _SingleTableOrderPlan[] stops;
30
31    /**
32     * int variable used to check whether order can be restricted to single table.
33     */

34
35    private int match = -1;
36
37    /**
38     * Represents the table details. if view is specified then these are tables
39     * present in view.
40     */

41
42    private TableDetails[] tableDetails;
43
44    public OrderMappingWithTableRefernces ( _SingleTableOrderPlan[] plans0 , int match0, TableDetails[] tableDetails0) throws DException {
45       stops = plans0;
46       match = match0;
47       tableDetails = tableDetails0;
48    }
49
50    /**
51     * It allows user to check whether order can be restricted to single table.
52     * @return
53     */

54
55    public int getMatch() {
56       return match;
57    }
58
59    /**
60     * Returns the single table level order present in order plan.
61     * @return
62     */

63
64    public _SingleTableOrderPlan[] getStops() {
65       return stops;
66    }
67
68    public String JavaDoc toString() {
69       return "OrderMapping["+P.print(stops)+"]"+ match;
70    }
71
72    /**
73     * Returns the tables.
74     * @return
75     * @throws DException
76     */

77
78    public TableDetails[] getTableDetails() throws DException {
79       return tableDetails;
80    }
81
82    /**
83     * It is needed to check whether passed single table order plan is present
84     * in the list of single table order plan.
85     * @param stop
86     * @return
87     * @throws DException
88     */

89
90    public boolean isBelongTo(_SingleTableOrderPlan stop) throws DException{
91       for (int i = 0; i < stops.length; i++) {
92          if(stops[i] == stop)
93             return true;
94       }
95       return false;
96    }
97 }
98
Popular Tags