add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / queryparser / src / java / org / apache / lucene / queryParser / core / processors / QueryNodeProcessor.java
1 package org.apache.lucene.queryParser.core.processors;
2
3 /**
4  * Licensed to the Apache Software Foundation (ASF) under one or more
5  * contributor license agreements.  See the NOTICE file distributed with
6  * this work for additional information regarding copyright ownership.
7  * The ASF licenses this file to You under the Apache License, Version 2.0
8  * (the "License"); you may not use this file except in compliance with
9  * the License.  You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 import org.apache.lucene.queryParser.core.QueryNodeException;
21 import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
22 import org.apache.lucene.queryParser.core.nodes.QueryNode;
23
24 /**
25  * <p>
26  * A {@link QueryNodeProcessor} is an interface for classes that process a
27  * {@link QueryNode} tree.
28  * <p>
29  * </p>
30  * The implementor of this class should perform some operation on a query node
31  * tree and return the same or another query node tree.
32  * <p>
33  * </p>
34  * It also may carry a {@link QueryConfigHandler} object that contains
35  * configuration about the query represented by the query tree or the
36  * collection/index where it's intended to be executed.
37  * <p>
38  * </p>
39  * In case there is any {@link QueryConfigHandler} associated to the query tree
40  * to be processed, it should be set using
41  * {@link QueryNodeProcessor#setQueryConfigHandler(QueryConfigHandler)} before
42  * {@link QueryNodeProcessor#process(QueryNode)} is invoked.
43  * 
44  * @see QueryNode
45  * @see QueryNodeProcessor
46  * @see QueryConfigHandler
47  */
48 public interface QueryNodeProcessor {
49
50   /**
51    * Processes a query node tree. It may return the same or another query tree.
52    * I should never return <code>null</code>.
53    * 
54    * @param queryTree
55    *          tree root node
56    * 
57    * @return the processed query tree
58    * 
59    * @throws QueryNodeException
60    */
61   public QueryNode process(QueryNode queryTree) throws QueryNodeException;
62
63   /**
64    * Sets the {@link QueryConfigHandler} associated to the query tree.
65    * 
66    * @param queryConfigHandler
67    */
68   public void setQueryConfigHandler(QueryConfigHandler queryConfigHandler);
69
70   /**
71    * Returns the {@link QueryConfigHandler} associated to the query tree if any,
72    * otherwise it returns <code>null</code>
73    * 
74    * @return the {@link QueryConfigHandler} associated to the query tree if any,
75    *         otherwise it returns <code>null</code>
76    */
77   public QueryConfigHandler getQueryConfigHandler();
78
79 }