Package com.topologi.diffx.load
Class AttributeComparator
java.lang.Object
com.topologi.diffx.load.AttributeComparator
- All Implemented Interfaces:
Comparator<AttributeEvent>
A comparator in order to put attributes in the correct order, that is in the alphabetical order
of the attribute name and namespace URI.
- Version:
- 10 May 2010
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(AttributeEvent o1, AttributeEvent o2) Compares two objects if they are attributes.intcompare(AttributeEventImpl att1, AttributeEventImpl att2) Compares two attribute events using their name.intcompare(AttributeEventNSImpl att1, AttributeEventNSImpl att2) Compares two simple attribute events using their name and namespace URI.private static StringReturns a comparable name from the given attribute's namespace URI and name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
AttributeComparator
AttributeComparator()
-
-
Method Details
-
compare
Compares two objects if they are attributes.- Specified by:
comparein interfaceComparator<AttributeEvent>- Throws:
ClassCastException
-
compare
Compares two attribute events using their name.- Parameters:
att1- The first attribute to be compared.att2- The second attribute to be compared.- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
compare
Compares two simple attribute events using their name and namespace URI.- Parameters:
att1- The first attribute to be compared.att2- The second attribute to be compared.- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
toCName
Returns a comparable name from the given attribute's namespace URI and name.- Parameters:
att- The attribute.- Returns:
- The comparable name.
-