|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.xml.Dom4jNodeListComparator
public class Dom4jNodeListComparator
Compares two dom4j nodes using an xPath. Note that a dom4j Node List can be sorted using the native
method: List sortedList = document.selectNodes("/ListSets/set","setName");
Field Summary | |
---|---|
static int |
ASCENDING
Sort ascending. |
static int |
DESCENDING
Sort descending. |
Constructor Summary | |
---|---|
Dom4jNodeListComparator(String xPath)
Default constructor that sorts descending. |
|
Dom4jNodeListComparator(String xPath,
int sortOrder)
Constructor that allows setting the sort order by ascending or descending. |
Method Summary | |
---|---|
int |
compare(Object o1,
Object o2)
Compares two dom4j Nodes for sorting by an xPath. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
public static final int ASCENDING
public static final int DESCENDING
Constructor Detail |
---|
public Dom4jNodeListComparator(String xPath, int sortOrder)
sortOrder
- The order for sorting (ASCENDING or DESCENDING)xPath
- An xPath relative to the node rootASCENDING
,
DESCENDING
public Dom4jNodeListComparator(String xPath)
xPath
- An xPath relative to the node rootMethod Detail |
---|
public int compare(Object o1, Object o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
compare
in interface Comparator
o1
- The first Object.o2
- The second Object.
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |