KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > search > basic > expression > BasicExpression


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/expression/BasicExpression.java,v 1.5 2004/07/28 09:34:50 ib Exp $
3  * $Revision: 1.5 $
4  * $Date: 2004/07/28 09:34:50 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.search.basic.expression;
25
26 import java.util.List JavaDoc;
27 import org.apache.slide.search.InvalidQueryException;
28 import org.apache.slide.search.basic.BasicExpressionFactory;
29 import org.apache.slide.search.basic.BasicResultSetImpl;
30 import org.apache.slide.search.basic.IBasicExpression;
31 import org.apache.slide.search.basic.IBasicExpressionFactory;
32 import org.apache.slide.search.basic.IBasicResultSet;
33 import org.jdom.Attribute;
34 import org.jdom.Element;
35
36 /**
37  * A BasicSearchExpression represents exactly one operator (AND, GT, ...).
38  *
39  * @version $Revision: 1.5 $
40  */

41 public abstract class BasicExpression implements IBasicExpression {
42     
43     protected BasicExpressionFactory expressionFactory;
44     
45     /** the JDOM element representing this expression. */
46     protected Element expressionElement;
47     
48     /** the resultset of this expression, if it has the state resolved */
49     protected IBasicResultSet resultSet = new BasicResultSetImpl();
50        
51     /** backptr to the factory that created this expression */
52     private IBasicExpressionFactory factory;
53     
54     
55     /**
56      * constructor. Only called by the conrecte expressions
57      *
58      * @param e the jdom element representing this expression.
59      */

60     protected BasicExpression (Element e) throws InvalidQueryException {
61         this.expressionElement = e;
62         List JavaDoc attrList = e.getAttributes();
63         if (attrList.size() != 0) {
64             Attribute attr = (Attribute) attrList.get(0);
65             throw new InvalidQueryException (attr.getQualifiedName() +
66                                                  " is an unprocessable entity");
67         }
68     }
69     
70     /**
71      * writes backptr to the factory
72      *
73      * @param factory an IBasicExpressionFactory
74      *
75      */

76     public void setFactory (IBasicExpressionFactory factory) {
77         this.factory = factory;
78     }
79     
80     /**
81      * factory accessor
82      *
83      * @return an IBasicExpressionFactory
84      *
85      */

86     public IBasicExpressionFactory getFactory() {
87         return this.factory;
88     }
89    
90 }
91
92
Popular Tags