KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > search > impl > lucene > query > StructuredFieldPosition


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.search.impl.lucene.query;
18
19 import java.io.IOException JavaDoc;
20
21 /**
22  * Elements used to test agains path and Qname
23  *
24  * @author andyh
25  */

26 public interface StructuredFieldPosition
27 {
28
29     /**
30      * Does this element match
31      *
32      * @param start -
33      * the start postion of the paths terms
34      * @param end -
35      * the end position of the paths terms
36      * @param offset -
37      * the current offset in the path
38      * @return returns the next match position (usually offset + 1) or -1 if it
39      * does not match.
40      * @throws IOException
41      */

42     public int matches(int start, int end, int offset) throws IOException JavaDoc;
43
44     /**
45      * If this position is last in the chain and it is terminal it will ensure
46      * it is an exact match for the length of the chain found. If false, it will
47      * effectively allow prefix mathces for the likes of descendant-and-below
48      * style queries.
49      *
50      * @return
51      */

52     public boolean isTerminal();
53
54     /**
55      * Is this an absolute element; that is, it knows its exact position.
56      *
57      * @return
58      */

59     public boolean isAbsolute();
60
61     /**
62      * This element only knows its position relative to the previous element.
63      *
64      * @return
65      */

66     public boolean isRelative();
67
68     /**
69      * Get the test to search for in the term query. This may be null if it
70      * should not have a term query
71      *
72      * @return
73      */

74     public String JavaDoc getTermText();
75
76     /**
77      * If absolute return the position. If relative we could compute the
78      * position knowing the previous term unless this element is preceded by a
79      * descendat and below style element
80      *
81      * @return
82      */

83     public int getPosition();
84
85     /**
86      * A reference to the caching term positions this element uses. This may be
87      * null which indicates all terms match, in that case there is no action
88      * against the index
89      *
90      * @param tps
91      */

92     public void setCachingTermPositions(CachingTermPositions tps);
93
94     public CachingTermPositions getCachingTermPositions();
95
96     /**
97      * Normally paths would require onlt parent chaining. for some it is parent
98      * and child chaining.
99      *
100      * @return
101      */

102
103     public boolean linkSelf();
104     
105     public boolean linkParent();
106
107     public boolean allowslinkingByParent();
108     
109     public boolean allowsLinkingBySelf();
110     
111     public boolean isDescendant();
112     
113     public boolean matchesAll();
114 }
115
Popular Tags