org.apache.slide.search.basic
Interface ComparableResource

All Superinterfaces:
RequestedResource
All Known Implementing Classes:
ComparableResourceImpl

public interface ComparableResource
extends RequestedResource

Represents one item of a searcheable set. One item is identified with a unique URI. A RequestedItem may be compared against a property represented by property name and value (as String). These compare methods (equals(), greaterThan(), ...) use three valued logic (TRUE, FALSE, UNKNOWN). UNKNOWN is returned when this item does not know the property to compare against or when the value of that property may not be converted to the datatype of this items matching property (for example comparing a Float against the string "foo"). TODO: Namespace awareness!!

Version:
$Revision: 1.4 $

Method Summary
 int compareTo(ComparableResource otherResource, CompareHint hint)
          Compares this resource to another resource according to the given compareHints.
 int contains(java.lang.String literal)
          Checks, if the content of the resource contains a specific literal.
 int equals(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is EQUAL the matching property within this item.
 java.lang.String getExternalHref()
          returns the external href. / means: the root of this server for example http://localhost/
 java.lang.String getInternalHref()
          returns the internal href. / means: the root of this slide for example http://localhost/slide
 java.lang.Object getThisValue(java.lang.String propName, java.lang.String propNamespace)
          Retrieves the value for the given property of this Resource
 int greaterThan(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is greater than the matching property within this item.
 int greaterThanEquals(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is greater or equal than the matching property within this item.
 boolean isDefined(java.lang.String propName, java.lang.String propNamespace)
          Method isDefined
 int lowerThan(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is lower than the matching property within this item.
 int lowerThanEquals(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is lower or equal than the matching property within this item.
 int propContains(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Method propContains
 
Methods inherited from interface org.apache.slide.search.RequestedResource
getAllProperties, getAllPropertiesNames, getProperty, getProperty, getUri
 

Method Detail

getInternalHref

public java.lang.String getInternalHref()
returns the internal href. / means: the root of this slide for example http://localhost/slide

Returns:
the href of this item

getExternalHref

public java.lang.String getExternalHref()
returns the external href. / means: the root of this server for example http://localhost/

Returns:
the href of this item

greaterThan

public int greaterThan(java.lang.String propName,
                       java.lang.String propNamespace,
                       java.lang.String literal)
Checks, if a property, represented by its name and value (as String), is greater than the matching property within this item.

Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

lowerThan

public int lowerThan(java.lang.String propName,
                     java.lang.String propNamespace,
                     java.lang.String literal)
Checks, if a property, represented by its name and value (as String), is lower than the matching property within this item.

Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

greaterThanEquals

public int greaterThanEquals(java.lang.String propName,
                             java.lang.String propNamespace,
                             java.lang.String literal)
Checks, if a property, represented by its name and value (as String), is greater or equal than the matching property within this item.

Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

lowerThanEquals

public int lowerThanEquals(java.lang.String propName,
                           java.lang.String propNamespace,
                           java.lang.String literal)
Checks, if a property, represented by its name and value (as String), is lower or equal than the matching property within this item.

Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

equals

public int equals(java.lang.String propName,
                  java.lang.String propNamespace,
                  java.lang.String literal)
Checks, if a property, represented by its name and value (as String), is EQUAL the matching property within this item.

Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

getThisValue

public java.lang.Object getThisValue(java.lang.String propName,
                                     java.lang.String propNamespace)
Retrieves the value for the given property of this Resource

Parameters:
propName - the property name
Returns:
the value of the property within this item

compareTo

public int compareTo(ComparableResource otherResource,
                     CompareHint hint)
Compares this resource to another resource according to the given compareHints. This is used by ordering. A value < 0 is retuned, if this resource is to be placed before the other resource, not necessarily if is lower than the other resource (depending on isAscending() in hints).

Parameters:
otherResource - the other resource to compare to
hint - hints to do the compare (propName, isAscending...)
Returns:
an int indicating the sort order.

isDefined

public boolean isDefined(java.lang.String propName,
                         java.lang.String propNamespace)
Method isDefined

Parameters:
propName - a String
Returns:
true if propName is defined in this resource.

propContains

public int propContains(java.lang.String propName,
                        java.lang.String propNamespace,
                        java.lang.String literal)
Method propContains

Parameters:
propName - a String
literal - a String
Returns:
true if literal is contained in this prop's value

contains

public int contains(java.lang.String literal)
Checks, if the content of the resource contains a specific literal.

Parameters:
literal - a String
Returns:
true if literal is contained in this resources' content