KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dql > plan > condition > JoinPredicate


1 package com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition;
2
3 import java.util.*;
4 import com.daffodilwoods.daffodildb.server.sql99.common.*;
5 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*;
6 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.predicates.*;
7 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*;
8 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
9 import com.daffodilwoods.database.resource.*;
10 /**
11  * This class represents predicate which involve more than one column of type
12  * reference and solved by index known as joinpredicate.e.g A=B. It is required
13  * for appropriate merging of different predicates.
14  * <p>Title: </p>
15  * <p>Description: </p>
16  * <p>Copyright: Copyright (c) 2004</p>
17  * <p>Company: </p>
18  * @author not attributable
19  * @version 1.0
20  */

21 public class JoinPredicate extends PredicateAbstract implements predicate {
22   /**
23    * It represents join condition on which join predicate is made.
24    */

25   private booleanvalueexpression condition;
26
27    public JoinPredicate(booleanvalueexpression condition0) {
28       condition = condition0;
29    }
30    /**
31     * It is required to check whether condition involve is subquery or not.
32     * If condition is subquey it return true. else return false.
33     * @return
34     * @throws DException
35     */

36    public boolean checkForSubQuery() throws DException {
37       return condition.checkForSubQuery();
38    }
39    /**
40     * Note:-following method never been called
41     * @param tableDetails
42     * @return
43     * @throws DException
44     */

45    public _QualifiedBVE getQualifiedBVE(TableDetails[] tableDetails) throws DException {
46       throw new DException("DSE565", new Object JavaDoc[] {"getQualifiedBVE()"});
47    }
48
49    public void getTablesIncluded(ArrayList aList) throws DException {
50       throw new DException("DSE565", new Object JavaDoc[] {"getTablesIncluded(ArrayList aList)"});
51    }
52    public void setColumnPredicates(_AllColumnPredicates allColumnPredicates) throws DException {
53       throw new DException("DSE565", new Object JavaDoc[] {"execute()"});
54    }
55
56    public ParameterInfo[] getParameterInfo() throws DException {
57       throw new DException("DSE565", new Object JavaDoc[] {"getParameterInfo()"});
58    }
59    public com.daffodilwoods.daffodildb.server.sql99.utils._Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession parent) throws DException {
60       throw new DException("DSE565", new Object JavaDoc[] {"checkSemantic(queryspecification parent)"});
61    }
62    /**
63     * Computes Cost of solving predicate for rows passed, boolean is passed to
64     * indicate whether predicate is solvable by index or not.
65     */

66
67    public double getCost(long rowCount, boolean index) throws DException {
68       return condition.getCost(rowCount, index);
69    }
70
71    public Object JavaDoc run(Object JavaDoc object) throws DException {
72       return condition.run(object);
73    }
74
75    public String JavaDoc toString() {
76       return condition.toString();
77    }
78    /**
79     * This method used to get condition from predicate.Usage of this method in
80     * tableplanmerger during merging of predicate.
81     * @return
82     * @throws DException
83     */

84    public booleanvalueexpression getCondition() throws DException {
85       return condition;
86    }
87
88    /**
89     * This method returns all the children of this class. It is needed in
90     * Abstract classes, so as to move common methods in Abstract class.
91     * @return
92     */

93    public AbstractRowValueExpression[] getChilds() {
94       AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] { (AbstractRowValueExpression) condition};
95       return childs;
96    }
97
98    public void setDefaultValues(_VariableValueOperations variableValueOperations) throws DException {
99    }
100
101    /**
102     * This method returns the estimate number of the rows remaining after the execution
103     * of this condition on passed number of rows.
104     * @param noOfRows
105     * @return
106     * @throws DException
107     */

108    public long getEstimatedRows(long noOfRows) throws DException {
109       return condition.getEstimatedRows(noOfRows);
110    }
111
112
113    /**
114     * This method is used to get type of predicate.
115     * @return
116     * @throws DException
117     */

118    public int getPredicateType() throws DException {
119       return OperatorConstants.JOINCOMPARISONPREDICATE;
120    }
121 }
122
Popular Tags