39 * key (an empty namespace URI is lexicographically least). |
39 * key (an empty namespace URI is lexicographically least). |
40 * </UL> |
40 * </UL> |
41 * |
41 * |
42 * @author Christian Geuer-Pollmann |
42 * @author Christian Geuer-Pollmann |
43 */ |
43 */ |
44 public class AttrCompare implements Comparator, Serializable { |
44 public class AttrCompare implements Comparator<Attr>, Serializable { |
45 |
45 |
46 private final static long serialVersionUID = -7113259629930576230L; |
46 private final static long serialVersionUID = -7113259629930576230L; |
47 private final static int ATTR0_BEFORE_ATTR1 = -1; |
47 private final static int ATTR0_BEFORE_ATTR1 = -1; |
48 private final static int ATTR1_BEFORE_ATTR0 = 1; |
48 private final static int ATTR1_BEFORE_ATTR0 = 1; |
49 private final static String XMLNS=Constants.NamespaceSpecNS; |
49 private final static String XMLNS=Constants.NamespaceSpecNS; |
60 * <LI> An element's attribute nodes are sorted lexicographically with |
60 * <LI> An element's attribute nodes are sorted lexicographically with |
61 * namespace URI as the primary key and local name as the secondary |
61 * namespace URI as the primary key and local name as the secondary |
62 * key (an empty namespace URI is lexicographically least). |
62 * key (an empty namespace URI is lexicographically least). |
63 * </UL> |
63 * </UL> |
64 * |
64 * |
65 * @param obj0 casted Attr |
65 * @param attr0 |
66 * @param obj1 casted Attr |
66 * @param attr1 |
67 * @return returns a negative integer, zero, or a positive integer as |
67 * @return returns a negative integer, zero, or a positive integer as |
68 * obj0 is less than, equal to, or greater than obj1 |
68 * obj0 is less than, equal to, or greater than obj1 |
69 * |
69 * |
70 */ |
70 */ |
71 public int compare(Object obj0, Object obj1) { |
71 public int compare(Attr attr0, Attr attr1) { |
72 |
72 |
73 Attr attr0 = (Attr) obj0; |
|
74 Attr attr1 = (Attr) obj1; |
|
75 String namespaceURI0 = attr0.getNamespaceURI(); |
73 String namespaceURI0 = attr0.getNamespaceURI(); |
76 String namespaceURI1 = attr1.getNamespaceURI(); |
74 String namespaceURI1 = attr1.getNamespaceURI(); |
77 |
75 |
78 boolean isNamespaceAttr0 = XMLNS==namespaceURI0; |
76 boolean isNamespaceAttr0 = XMLNS==namespaceURI0; |
79 boolean isNamespaceAttr1 = XMLNS==namespaceURI1; |
77 boolean isNamespaceAttr1 = XMLNS==namespaceURI1; |