org.mmbase.bridge.util
Class NodeFieldComparator
java.lang.Object
org.mmbase.bridge.util.NodeFieldComparator
- All Implemented Interfaces:
- Comparator<Node>
public class NodeFieldComparator
- extends Object
- implements Comparator<Node>
Comparator two nodes based on the string value in the specified field.
|
Method Summary |
int |
compare(Node n1,
Node n2)
Two external source objects are said to be equal only when the two type fields match. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
field
protected String field
ascending
protected boolean ascending
NodeFieldComparator
public NodeFieldComparator(String field)
- Basic constructor.
- Parameters:
field - the node field to compare the nodes on
NodeFieldComparator
public NodeFieldComparator(String field,
boolean ascending)
- Basic constructor.
- Parameters:
field - the node field to compare the nodes onascending - sort the list ascending or descending
compare
public int compare(Node n1,
Node n2)
- Two external source objects are said to be equal only when the two type fields match. The
objects to compare can be of type
Node.
- Specified by:
compare in interface Comparator<Node>
- Parameters:
n1 - the first node.n2 - the second node
- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than,
equal to, or greater than the second.
- See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
MMBase 2.0-SNAPSHOT - null