KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dql > iterator > set > FullJoinUnionIterator


1 package com.daffodilwoods.daffodildb.server.sql99.dql.iterator.set;
2
3 /**
4  * <p>Title: FullJoinUnionIterator </p>
5  * <p>Description: This Class assists to retrive the result of FULL OUTER JOIN.
6  * FULL OUTER JOIN is retrived by Union All of LOJ of given underlying iterators
7  * and specialRightJoinIterator iterator.
8  *
9  * This class has only retrieval methods. All the other methods are used
10  * from the extending class UnionAllIterator that alignes underlying iterators
11  * acc. to navigation methods. </p>
12  * <p>Copyright: Copyright (c) 2003</p>
13  * <p>Company: </p>
14  * @author unascribed
15  * @version 1.0
16  */

17 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*;
18 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
19 import com.daffodilwoods.daffodildb.utils.field.*;
20 import com.daffodilwoods.database.resource.*;
21 import com.daffodilwoods.database.utility.P;
22
23 public class FullJoinUnionIterator extends UnionAllIterator {
24
25    public FullJoinUnionIterator(_Iterator leftIterator0, _Iterator rightIterator0) throws DException {
26       super(leftIterator0, rightIterator0, null, null, null, null, null, null);
27    }
28
29    /**
30     * The following methods are used for getting values of current record.
31     * These methods check the passed column, if the column corresponds to left
32     * iterator, its values are retrived from the left iterator, otherwise, from
33     * the right iterator.
34     */

35    /**
36     * This method is used to retrieve the value of passed reference.
37     * @param reference reference for which value is to be retrived.
38     * Reference may be column or parameter.
39     * @return NonShared FieldBase denoting the value of Reference. Non Shared
40     * FieldBases are those for which BufferRange is not shared with some other
41     * FieldBase.
42     * @throws DException
43     */

44    public Object JavaDoc getColumnValues(_Reference reference) throws DException {
45       if (state == FIRSTISCURRENT) {
46          return leftIterator.getColumnValues(reference);
47       } else if (state == SECONDISCURRENT) {
48          return rightIterator.getColumnValues(reference);
49       }
50       throw new DException("DSE3518", null);
51    }
52
53    /**
54     * This method is used to retrieve the values of passed references.
55     * @param references reference for which values are to be retrived.
56     * Reference may be column or parameter.
57     * @return NonShared FieldBases denoting the value of References. Non Shared
58     * FieldBases are those for which BufferRange is not shared with some other
59     * FieldBase.
60     * @throws DException
61     */

62    public Object JavaDoc getColumnValues(_Reference[] references) throws DException {
63       if (state == FIRSTISCURRENT) {
64          return leftIterator.getColumnValues(references);
65       } else if (state == SECONDISCURRENT) {
66          return rightIterator.getColumnValues(references);
67       }
68       throw new DException("DSE3518", null);
69    }
70
71    /**
72     * The following methods are used for getting values of current record.
73     * These methods return values for all columns, if the state is FIRSTISCURRENT then it
74     * return the valuesretrived from the left iterator,else if state is SECONDISCURRENT then
75     * its return the values retrived from the rightIterator.
76     * @author Sandeep
77     * @since After version 4.0
78     * @usage MemoryIndexIterator
79     */

80
81    public Object JavaDoc getColumnValues() throws DException {
82      if (state == FIRSTISCURRENT) {
83         return leftIterator.getColumnValues();
84      } else if (state == SECONDISCURRENT) {
85         return rightIterator.getColumnValues();
86      }
87      throw new DException("DSE3518", null);
88   }
89
90
91    /**
92     * This method return the shared FieldBase for the passed reference. By Shared
93     * FieldBase we mean, BufferRange of FieldBase is shared with other FieldBase
94     * objects.
95     * @param references reference for which value is to be retrived
96     * @return shared field base correspondition to passed column reference
97     * @throws DException
98     */

99    public FieldBase field(_Reference reference) throws com.daffodilwoods.database.resource.DException {
100       return state == FIRSTISCURRENT ? leftIterator.field(reference) : rightIterator.field(reference);
101    }
102
103    /**
104     * This method return the shared FieldBases for the passed references. By Shared
105     * FieldBase we mean, BufferRange of FieldBase is shared with other FieldBase
106     * objects.
107     * @param references reference for which values are to be retrived
108     * @return shared field base correspondition to passed column reference
109     * @throws DException
110     */

111    public FieldBase[] fields(_Reference[] references) throws com.daffodilwoods.database.resource.DException {
112       return state == FIRSTISCURRENT ? leftIterator.fields(references) : rightIterator.fields(references);
113    }
114
115
116
117    public void setSpecificUnderlyingReferences(_Reference[] specificUnderlyingReferences) throws DException{
118      underlyingRef=specificUnderlyingReferences;
119    }
120
121 }
122
Popular Tags