KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > search > basic > ComparableResource


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/ComparableResource.java,v 1.4 2004/07/28 09:35:02 ib Exp $
3  * $Revision: 1.4 $
4  * $Date: 2004/07/28 09:35:02 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999 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 package org.apache.slide.search.basic;
24
25 import org.apache.slide.search.CompareHint;
26 import org.apache.slide.search.RequestedResource;
27
28 /**
29  * Represents one item of a searcheable set. One item is identified with a
30  * unique URI.
31  * A RequestedItem may be compared against a property represented by property
32  * name and value (as String). These compare methods (equals(),
33  * greaterThan(), ...) use three valued logic (TRUE, FALSE, UNKNOWN). UNKNOWN is
34  * returned when this item does not know the property to compare against or
35  * when the value of that property may not be converted to the datatype of this
36  * items matching property (for example comparing a Float against the
37  * string "foo").
38  *
39  * TODO: Namespace awareness!!
40  *
41  * @version $Revision: 1.4 $
42  */

43 public interface ComparableResource extends RequestedResource {
44     
45     
46     /**
47      * returns the internal href. / means: the root of this slide
48      * for example http://localhost/slide
49      *
50      * @return the href of this item
51      */

52     public String JavaDoc getInternalHref ();
53     
54     
55     /**
56      * returns the external href. / means: the root of this server
57      * for example http://localhost/
58      *
59      * @return the href of this item
60      */

61     public String JavaDoc getExternalHref ();
62     
63     
64     /**
65      * Checks, if a property, represented by its name and value (as String),
66      * is greater than the matching property within this item.
67      *
68      * @param propName the name of the property to check
69      * @param literal the value as String to check again
70      *
71      * @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
72      *
73      */

74     public int greaterThan (String JavaDoc propName, String JavaDoc propNamespace, String JavaDoc literal);
75     
76     /**
77      * Checks, if a property, represented by its name and value (as String),
78      * is lower than the matching property within this item.
79      *
80      * @param propName the name of the property to check
81      * @param literal the value as String to check again
82      *
83      * @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
84      *
85      */

86     public int lowerThan (String JavaDoc propName, String JavaDoc propNamespace, String JavaDoc literal);
87     
88     /**
89      * Checks, if a property, represented by its name and value (as String),
90      * is greater or equal than the matching property within this item.
91      *
92      * @param propName the name of the property to check
93      * @param literal the value as String to check again
94      *
95      * @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
96      *
97      */

98     public int greaterThanEquals (String JavaDoc propName, String JavaDoc propNamespace, String JavaDoc literal);
99     
100     /**
101      * Checks, if a property, represented by its name and value (as String),
102      * is lower or equal than the matching property within this item.
103      *
104      * @param propName the name of the property to check
105      * @param literal the value as String to check again
106      *
107      * @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
108      *
109      */

110     public int lowerThanEquals (String JavaDoc propName, String JavaDoc propNamespace, String JavaDoc literal);
111     
112     /**
113      * Checks, if a property, represented by its name and value (as String),
114      * is EQUAL the matching property within this item.
115      *
116      * @param propName the name of the property to check
117      * @param literal the value as String to check again
118      *
119      * @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
120      *
121      */

122     public int equals (String JavaDoc propName, String JavaDoc propNamespace, String JavaDoc literal);
123     
124     /**
125      * Retrieves the value for the given property of this Resource
126      *
127      * @param propName the property name
128      *
129      * @return the value of the property within this item
130      */

131     public Object JavaDoc getThisValue (String JavaDoc propName, String JavaDoc propNamespace);
132     
133     
134     /**
135      * Compares this resource to another resource according to the given
136      * compareHints. This is used by ordering. A value < 0 is retuned, if this
137      * resource is to be placed before the other resource, not necessarily if
138      * is lower than the other resource (depending on isAscending() in hints).
139      *
140      * @param otherResource the other resource to compare to
141      * @param hint hints to do the compare (propName, isAscending...)
142      *
143      * @return an int indicating the sort order.
144      *
145      *
146      */

147     public int compareTo (ComparableResource otherResource, CompareHint hint);
148     
149     /**
150      * Method isDefined
151      *
152      * @param propName a String
153      *
154      * @return true if propName is defined in this resource.
155      *
156      */

157     public boolean isDefined (String JavaDoc propName, String JavaDoc propNamespace);
158     
159     /**
160      * Method propContains
161      *
162      * @param propName a String
163      * @param literal a String
164      *
165      * @return true if literal is contained in this prop's value
166      *
167      */

168     public int propContains (String JavaDoc propName, String JavaDoc propNamespace, String JavaDoc literal);
169     
170     /**
171      * Checks, if the content of the resource contains a specific literal.
172      *
173      * @param literal a String
174      *
175      * @return true if literal is contained in this resources' content
176      *
177      */

178     public int contains (String JavaDoc literal);
179     
180 }
181
182
183
Popular Tags