net.sf.mmapps.commons.bridge
Class NodeFieldComparator
java.lang.Object
net.sf.mmapps.commons.bridge.NodeFieldComparator
- All Implemented Interfaces:
- java.util.Comparator<org.mmbase.bridge.Node>
public class NodeFieldComparator
- extends java.lang.Object
- implements java.util.Comparator<org.mmbase.bridge.Node>
Comparator two nodes based on the string value in the specified field.
Field Summary |
protected boolean |
ascending
|
protected java.lang.String |
field
|
Method Summary |
int |
compare(org.mmbase.bridge.Node n1,
org.mmbase.bridge.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 |
Methods inherited from interface java.util.Comparator |
equals |
field
protected java.lang.String field
ascending
protected boolean ascending
NodeFieldComparator
public NodeFieldComparator(java.lang.String field)
- Basic constructor.
- Parameters:
field
- the node field to compare the nodes on
NodeFieldComparator
public NodeFieldComparator(java.lang.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(org.mmbase.bridge.Node n1,
org.mmbase.bridge.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 java.util.Comparator<org.mmbase.bridge.Node>
- Parameters:
o1
- the first external source node.o2
- the first external source node
- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than,
equal to, or greater than the second.
Copyright © 2003-2006 mmapps. All Rights Reserved.