cz.cuni.versatile.api
Interface OrderProperty

All Superinterfaces:
Property, RelationalProperty
All Known Subinterfaces:
Taxonomy, TreeTaxonomy

public interface OrderProperty
extends RelationalProperty

OrderProperty is an interface to denote a commonly used specialization of RelationalProperty.

It encompasses all the various types of order: partial order, total order (linear order), strict order It imposes restrictions on several methods of its parent RelationalProperty interface. The following rules must hold for any OrderProperty implementation to be a valid implementation:

* @author Jaroslav Gergic


Method Summary
 boolean comparable(java.lang.Object entryA, java.lang.Object entryB)
          Checks whether two values are comparable given a particular OrderProperty.
 java.util.Comparator comparator()
          Returns a comparator suitable for Java Collections utility classes.
 boolean isPartialOrder()
          Checks whether a particular OrderProperty defines a partial order.
 boolean isStrictOrder()
          Checks whether a particular OrderProperty defines a strict order.
 boolean isTotalOrder()
          Checks whether a particular OrderProperty defines a total order.
 
Methods inherited from interface cz.cuni.versatile.api.RelationalProperty
contains, isAntisymmetric, isAsymetric, isIrreflexive, isReflexive, isSymmetric, isTransitive
 
Methods inherited from interface cz.cuni.versatile.api.Property
getLocalName, getNamespace, getSeparator, getType, getUniqueName
 

Method Detail

comparator

public java.util.Comparator comparator()
Returns a comparator suitable for Java Collections utility classes.

Remarks: Please note, that unless isTotalOrder() = true, we consider an order to be a partial order and therefore the comparator instance returned by this method may not be suitable for usage by Java Collections framework, as it always assumes total (linear) order. If two values are not comparable (due to partial order) the Comparator.compare() method should return 0 (zero).

Returns:
a comparator instance
See Also:
Collections, comparable(Object, Object)

comparable

public boolean comparable(java.lang.Object entryA,
                          java.lang.Object entryB)
Checks whether two values are comparable given a particular OrderProperty.
Remarks: Please note that if isTotalOrder() = true this method must always return true

Parameters:
entryA - a property value to compare
entryB - a property value to compare
Returns:
true if contains(entryA, entryB) or contains(entryB, entryA)

isTotalOrder

public boolean isTotalOrder()
Checks whether a particular OrderProperty defines a total order.

Returns:
true if for all x,y: comparable(x, y) = true

isPartialOrder

public boolean isPartialOrder()
Checks whether a particular OrderProperty defines a partial order.

Returns:
not isTotalOrder() (i.e. an opposite to total order)

isStrictOrder

public boolean isStrictOrder()
Checks whether a particular OrderProperty defines a strict order.

Returns:
not isReflexive() (i.e. true for irreflexive relations)