com.novell.xml.dom
Class DocumentOrderComparator
java.lang.Object
com.novell.xml.dom.DocumentOrderComparator
- All Implemented Interfaces:
- Comparator
- public class DocumentOrderComparator
- extends Object
- implements Comparator
Class implementing the Comparator
interface for DOM-level 1
nodes.
This class imposes a document-ordering on nodes.
This will also impose a stable order on nodes
from different documents (i.e., they have different owner
documents)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DocumentOrderComparator
public DocumentOrderComparator()
compare
public int compare(Object o1,
Object o2)
- Compare first node with second node for document order.
- Specified by:
compare
in interface Comparator
- Parameters:
o1
- first nodeo2
- second node
- Returns:
- < 0 if o1 comes before o2 in document order
== 0 if o1 is at same position in document order as o2
(which can only happen if nodes are the same node)
> 0 if o1 comes after o2 in document order
compareDocs
protected static int compareDocs(Document doc1,
Document doc2)
- Compare to different documents and get a stable order
- Parameters:
doc1
- The left-hand-side documentdoc2
- The right-hand-side document
- Returns:
- < 0 if doc1 comes before doc2, > 0 if doc2 comes
before doc1