org.apache.directory.shared.ldap.schema.comparators
Class ComparableComparator<T>

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.AbstractSchemaObject
      extended by org.apache.directory.shared.ldap.schema.LoadableSchemaObject
          extended by org.apache.directory.shared.ldap.schema.LdapComparator<java.lang.Comparable<T>>
              extended by org.apache.directory.shared.ldap.schema.comparators.ComparableComparator<T>
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<java.lang.Comparable<T>>, SchemaObject

public class ComparableComparator<T>
extends LdapComparator<java.lang.Comparable<T>>

Compares two objects taking into account that one might be a Comparable.

Version:
$Rev: 912436 $
Author:
Apache Directory Project
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
description, extensions, isEnabled, isObsolete, isReadOnly, locked, names, objectType, oid, schemaName, specification
 
Constructor Summary
ComparableComparator(java.lang.String oid)
          The BooleanComparator constructor.
 
Method Summary
 int compare(java.lang.Comparable<T> o1, java.lang.Comparable<T> o2)
          Compares two objects taking into account that one may be a Comparable.
 
Methods inherited from class org.apache.directory.shared.ldap.schema.LdapComparator
equals, setSchemaManager, toString
 
Methods inherited from class org.apache.directory.shared.ldap.schema.LoadableSchemaObject
copy, getBytecode, getFqcn, isValid, registerOid, setBytecode, setFqcn
 
Methods inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
addExtension, addName, addToRegistries, clear, compareOid, copy, getDescription, getExtensions, getName, getNames, getObjectType, getOid, getSchemaName, getSpecification, hashCode, isDisabled, isEnabled, isObsolete, isReadOnly, lock, removeFromRegistries, setDescription, setEnabled, setExtensions, setNames, setNames, setObsolete, setOid, setReadOnly, setRegistries, setSchemaName, setSpecification
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComparableComparator

public ComparableComparator(java.lang.String oid)
The BooleanComparator constructor. Its OID is the BooleanMatch matching rule OID.

Method Detail

compare

public int compare(java.lang.Comparable<T> o1,
                   java.lang.Comparable<T> o2)
Compares two objects taking into account that one may be a Comparable. If the first is a comparable then its compareTo operation is called and the result returned as is. If the first is not a Comparable but the second is then its compareTo method is called and the result is returned after being negated. If none are comparables the hashCode of o1 minus the hashCode of o2 is returned.

See Also:
Comparator.compare(Object, Object)


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.