Home » lucene-3.0.1-src » org.apache.lucene.queryParser.core.nodes » [javadoc | source]

    1   package org.apache.lucene.queryParser.core.nodes;
    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 java.io.Serializable;
   21   import java.util.List;
   22   import java.util.Map;
   23   
   24   import org.apache.lucene.queryParser.core.parser.EscapeQuerySyntax;
   25   
   26   /**
   27    * A {@link QueryNode} is a interface implemented by all nodes on a QueryNode
   28    * tree.
   29    */
   30   public interface QueryNode extends Serializable {
   31   
   32     /** convert to a query string understood by the query parser */
   33     // TODO: this interface might be changed in the future
   34     public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser);
   35   
   36     /** for printing */
   37     public String toString();
   38   
   39     /** get Children nodes */
   40     public List<QueryNode> getChildren();
   41   
   42     /** verify if a node is a Leaf node */
   43     public boolean isLeaf();
   44   
   45     /** verify if a node contains a tag */
   46     public boolean containsTag(CharSequence tagName);
   47   
   48     /**
   49      * @param tagName
   50      * @return of stored on under that tag name
   51      */
   52     public Object getTag(CharSequence tagName);
   53   
   54     public QueryNode getParent();
   55   
   56     /**
   57      * Recursive clone the QueryNode tree The tags are not copied to the new tree
   58      * when you call the cloneTree() method
   59      * 
   60      * @return the cloned tree
   61      * @throws CloneNotSupportedException
   62      */
   63     public QueryNode cloneTree() throws CloneNotSupportedException;
   64   
   65     // Below are the methods that can change state of a QueryNode
   66     // Write Operations (not Thread Safe)
   67   
   68     // add a new child to a non Leaf node
   69     public void add(QueryNode child);
   70   
   71     public void add(List<QueryNode> children);
   72   
   73     // reset the children of a node
   74     public void set(List<QueryNode> children);
   75   
   76     /**
   77      * Associate the specified value with the specified tagName. If the tagName
   78      * already exists, the old value is replaced. The tagName and value cannot be
   79      * null. tagName will be converted to lowercase.
   80      * 
   81      * @param tagName
   82      * @param value
   83      */
   84     public void setTag(CharSequence tagName, Object value);
   85   
   86     /**
   87      * Unset a tag. tagName will be converted to lowercase.
   88      * 
   89      * @param tagName
   90      */
   91     public void unsetTag(CharSequence tagName);
   92   
   93     public Map<CharSequence, Object> getTags();
   94   
   95   }

Home » lucene-3.0.1-src » org.apache.lucene.queryParser.core.nodes » [javadoc | source]