KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dql > execution > HasRecordVariableValues


1 package com.daffodilwoods.daffodildb.server.sql99.dql.execution;
2
3 import com.daffodilwoods.daffodildb.server.serversystem.*;
4 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*;
5 import com.daffodilwoods.daffodildb.server.sql99.dql.listenerevents.*;
6 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
7 import com.daffodilwoods.daffodildb.utils.field.*;
8 import com.daffodilwoods.database.resource.*;
9
10 /**
11  * It represents the variablevalues for hasRecord columns. It contains
12  * variablevalues as well as mapping of hasRecord columns.
13  * <p>Title: </p>
14  * <p>Description: </p>
15  * <p>Copyright: Copyright (c) 2003</p>
16  * <p>Company: </p>
17  * @author unascribed
18  * @version 1.0
19  */

20
21 public class HasRecordVariableValues implements _VariableValues {
22
23    /**
24     * Represents the variablevalues.
25     */

26
27    private _VariableValues variableValues;
28
29    /**
30     * Represents the mapping of hasRecord columns and its corresponding iterator.
31     */

32
33    private Object JavaDoc[][] hasRecordMapping;
34
35    public HasRecordVariableValues(_VariableValues variableValues0, Object JavaDoc[][] hasRecordMapping0) {
36       variableValues = variableValues0;
37       hasRecordMapping = hasRecordMapping0;
38    }
39
40    /**
41     * Returns the values of passed references.
42     * @param parm1 represents the array of references. Reference can be either
43     * columns or parameters(?).
44     * @return non sharable fieldbases.
45     * @throws com.daffodilwoods.database.resource.DException
46     */

47
48    public Object JavaDoc getColumnValues(_Reference[] parm1) throws com.daffodilwoods.database.resource.DException {
49       int length = parm1.length;
50       Object JavaDoc[] values = new Object JavaDoc[length];
51       for (int i = 0; i < length; i++) {
52          values[i] = getColumnValues(parm1[i]);
53       }
54       return values;
55    }
56
57    /**
58     * Returns the values of passed references.
59     * @param parm1 represents the array of references. Reference can be either
60     * columns or parameters(?).
61     * @return sharable fieldbases.
62     * @throws com.daffodilwoods.database.resource.DException
63     */

64
65    public Object JavaDoc fields(_Reference[] parm1) throws com.daffodilwoods.database.resource.DException {
66       int length = parm1.length;
67       Object JavaDoc[] values = new Object JavaDoc[length];
68       for (int i = 0; i < length; i++) {
69          values[i] = field(parm1[i]);
70       }
71       return values;
72    }
73
74    /**
75     * Returns the value of passed reference. Firstly reference is checked
76     * whether it is hasRecord column or not through the help of hasRecord
77     * mapping. If it is found in mapping, then its value is retrieved from
78     * corresponding iterator. otherwise its value is retrieved from
79     * variablevalues.
80     * @param parm1
81     * @return non sharable fieldbases.
82     * @throws com.daffodilwoods.database.resource.DException
83     */

84
85    public Object JavaDoc getColumnValues(_Reference parm1) throws com.daffodilwoods.database.resource.DException {
86       for (int i = 0, length = hasRecordMapping.length; i < length; i++) {
87          if (parm1 == hasRecordMapping[i][0]) {
88             return ( (_HasRecordIterator) hasRecordMapping[i][1]).getHasRecordColumnValues();
89          }
90       }
91       return variableValues.getColumnValues(parm1);
92    }
93
94    /**
95     * Returns the value of passed reference. Firstly reference is checked
96     * whether it is hasRecord column or not through the help of hasRecord
97     * mapping. If it is found in mapping, then its value is retrieved from
98     * corresponding iterator. otherwise its value is retrieved from
99     * variablevalues.
100     * @param parm1
101     * @return sharable fieldbases.
102     * @throws com.daffodilwoods.database.resource.DException
103     */

104
105    public FieldBase field(_Reference parm1) throws com.daffodilwoods.database.resource.DException {
106       for (int i = 0, length = hasRecordMapping.length; i < length; i++) {
107          if (parm1 == hasRecordMapping[i][0]) {
108             return (FieldBase) ( (_HasRecordIterator) hasRecordMapping[i][1]).getHasRecordColumnValues();
109          }
110       }
111       return variableValues.field(parm1);
112    }
113
114    /**
115     * Following all methods belong to variable values, so all the methods are
116     * deligated to variablevalues present in this class.
117     */

118
119    public void setIterator(_Iterator parm1) throws com.daffodilwoods.database.resource.DException {
120       variableValues.setIterator(parm1);
121    }
122
123    public void setConditionVariableValue(_Reference[] parm1, Object JavaDoc[] parm2, int parm3) throws com.daffodilwoods.database.resource.DException {
124       variableValues.setConditionVariableValue(parm1, parm2, parm3);
125    }
126
127    public void addReferences(_Reference[] parm1) throws com.daffodilwoods.database.resource.DException {
128       variableValues.addReferences(parm1);
129    }
130
131    public Object JavaDoc[][] getReferenceAndValuePair() throws com.daffodilwoods.database.resource.DException {
132       return variableValues.getReferenceAndValuePair();
133    }
134
135    public void releaseResource() throws DException {
136       variableValues.releaseResource();
137    }
138
139    public _ServerSession getServerSession() throws DException {
140       return variableValues.getServerSession();
141    }
142
143 }
144
Popular Tags