com.unboundid.ldap.matchingrules
Class SimpleMatchingRule

java.lang.Object
  extended by com.unboundid.ldap.matchingrules.MatchingRule
      extended by com.unboundid.ldap.matchingrules.SimpleMatchingRule
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AcceptAllSimpleMatchingRule, NumericStringMatchingRule, TelephoneNumberMatchingRule

@Extensible
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public abstract class SimpleMatchingRule
extends MatchingRule

This class provides a common matching rule framework that may be extended by matching rule implementations in which equality, ordering, and substring matching can all be made based on byte-for-byte comparisons of the normalized value, for values that are considered acceptable by the MatchingRule.normalize(com.unboundid.asn1.ASN1OctetString) and MatchingRule.normalizeSubstring(com.unboundid.asn1.ASN1OctetString, byte) methods.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.unboundid.ldap.matchingrules.MatchingRule
SUBSTRING_TYPE_SUBANY, SUBSTRING_TYPE_SUBFINAL, SUBSTRING_TYPE_SUBINITIAL
 
Constructor Summary
SimpleMatchingRule()
           
 
Method Summary
 int compareValues(ASN1OctetString value1, ASN1OctetString value2)
          Compares the provided values to determine their relative order in a sorted list.
 boolean matchesSubstring(ASN1OctetString value, ASN1OctetString subInitial, ASN1OctetString[] subAny, ASN1OctetString subFinal)
          Indicates whether the provided value matches the given substring assertion, according to the constraints of this matching rule.
 boolean valuesMatch(ASN1OctetString value1, ASN1OctetString value2)
          Indicates whether the provided values are equal to each other, according to the constraints of this matching rule.
 
Methods inherited from class com.unboundid.ldap.matchingrules.MatchingRule
getDefaultEqualityMatchingRule, getDefaultOrderingMatchingRule, getDefaultSubstringMatchingRule, getEqualityMatchingRuleName, getEqualityMatchingRuleNameOrOID, getEqualityMatchingRuleOID, getOrderingMatchingRuleName, getOrderingMatchingRuleNameOrOID, getOrderingMatchingRuleOID, getSubstringMatchingRuleName, getSubstringMatchingRuleNameOrOID, getSubstringMatchingRuleOID, normalize, normalizeSubstring, selectEqualityMatchingRule, selectEqualityMatchingRule, selectEqualityMatchingRule, selectMatchingRuleForSyntax, selectOrderingMatchingRule, selectOrderingMatchingRule, selectOrderingMatchingRule, selectSubstringMatchingRule, selectSubstringMatchingRule, selectSubstringMatchingRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMatchingRule

public SimpleMatchingRule()
Method Detail

valuesMatch

public boolean valuesMatch(ASN1OctetString value1,
                           ASN1OctetString value2)
                    throws LDAPException
Indicates whether the provided values are equal to each other, according to the constraints of this matching rule.

Specified by:
valuesMatch in class MatchingRule
Parameters:
value1 - The first value for which to make the determination.
value2 - The second value for which to make the determination.
Returns:
true if the provided values are considered equal, or false if not.
Throws:
LDAPException - If a problem occurs while making the determination, or if this matching rule does not support equality matching.

matchesSubstring

public boolean matchesSubstring(ASN1OctetString value,
                                ASN1OctetString subInitial,
                                ASN1OctetString[] subAny,
                                ASN1OctetString subFinal)
                         throws LDAPException
Indicates whether the provided value matches the given substring assertion, according to the constraints of this matching rule.

Specified by:
matchesSubstring in class MatchingRule
Parameters:
value - The value for which to make the determination.
subInitial - The subInitial portion of the substring assertion, or null if there is no subInitial element.
subAny - The subAny elements of the substring assertion, or null if there are no subAny elements.
subFinal - The subFinal portion of the substring assertion, or null if there is no subFinal element.
Returns:
true if the provided value matches the substring assertion, or false if not.
Throws:
LDAPException - If a problem occurs while making the determination, or if this matching rule does not support substring matching.

compareValues

public int compareValues(ASN1OctetString value1,
                         ASN1OctetString value2)
                  throws LDAPException
Compares the provided values to determine their relative order in a sorted list.

Specified by:
compareValues in class MatchingRule
Parameters:
value1 - The first value to compare.
value2 - The second value to compare.
Returns:
A negative value if value1 should come before value2 in a sorted list, a positive value if value1 should come after value2 in a sorted list, or zero if the values are equal or there is no distinction between their orders in a sorted list.
Throws:
LDAPException - If a problem occurs while making the determination, or if this matching rule does not support ordering matching.