Class AttributeComparator

java.lang.Object
com.topologi.diffx.load.AttributeComparator
All Implemented Interfaces:
Comparator<AttributeEvent>

final class AttributeComparator extends Object implements 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 Details

    • AttributeComparator

      AttributeComparator()
  • Method Details

    • compare

      public int compare(AttributeEvent o1, AttributeEvent o2) throws ClassCastException
      Compares two objects if they are attributes.
      Specified by:
      compare in interface Comparator<AttributeEvent>
      Throws:
      ClassCastException
    • compare

      public int compare(AttributeEventImpl att1, AttributeEventImpl att2)
      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

      public int compare(AttributeEventNSImpl att1, AttributeEventNSImpl att2)
      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

      private static String toCName(AttributeEventNSImpl att)
      Returns a comparable name from the given attribute's namespace URI and name.
      Parameters:
      att - The attribute.
      Returns:
      The comparable name.