org.opends.server.api
Class OrderingMatchingRule

java.lang.Object
  extended by org.opends.server.api.MatchingRule<OrderingMatchingRuleCfg>
      extended by org.opends.server.api.OrderingMatchingRule
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<byte[]>
Direct Known Subclasses:
CaseExactOrderingMatchingRule, CaseIgnoreOrderingMatchingRule, GeneralizedTimeOrderingMatchingRule, HistoricalCsnOrderingMatchingRule, IntegerOrderingMatchingRule, NumericStringOrderingMatchingRule, OctetStringOrderingMatchingRule, UUIDOrderingMatchingRule

@PublicAPI(stability=VOLATILE,
           mayInstantiate=false,
           mayExtend=true,
           mayInvoke=false)
public abstract class OrderingMatchingRule
extends MatchingRule<OrderingMatchingRuleCfg>
implements java.util.Comparator<byte[]>, java.io.Serializable

This class defines the set of methods and structures that must be implemented by a Directory Server module that implements a matching rule used for determining the correct order of values when sorting or processing range filters.

See Also:
Serialized Form

Constructor Summary
OrderingMatchingRule()
           
 
Method Summary
abstract  int compareValues(ByteString value1, ByteString value2)
          Compares the first value to the second and returns a value that indicates their relative order.
 ConditionResult valuesMatch(ByteString attributeValue, ByteString assertionValue)
          Indicates whether the provided attribute value should be considered a match for the given assertion value.
 
Methods inherited from class org.opends.server.api.MatchingRule
equals, finalizeMatchingRule, getDescription, getName, getNameOrOID, getOID, getSyntaxOID, hashCode, initializeMatchingRule, isConfigurationAcceptable, isObsolete, normalizeValue, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
compare, equals
 

Constructor Detail

OrderingMatchingRule

public OrderingMatchingRule()
Method Detail

compareValues

public abstract int compareValues(ByteString value1,
                                  ByteString value2)
Compares the first value to the second and returns a value that indicates their relative order.

Parameters:
value1 - The normalized form of the first value to compare.
value2 - The normalized form of the second value to compare.
Returns:
A negative integer if value1 should come before value2 in ascending order, a positive integer if value1 should come after value2 in ascending order, or zero if there is no difference between the values with regard to ordering.

valuesMatch

public ConditionResult valuesMatch(ByteString attributeValue,
                                   ByteString assertionValue)
Indicates whether the provided attribute value should be considered a match for the given assertion value. This will only be used for the purpose of extensible matching.

Note that ordering matching rules by default do not support extensible matching, and therefore this method will always return UNDEFINED. If an ordering matching rule does support extensible matching operations, then it should override this method and provide an appropriate implementation.

Specified by:
valuesMatch in class MatchingRule<OrderingMatchingRuleCfg>
Parameters:
attributeValue - The attribute value in a form that has been normalized according to this matching rule.
assertionValue - The assertion value in a form that has been normalized according to this matching rule.
Returns:
true if the attribute value should be considered a match for the provided assertion value, or false if not.