DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.input
Class SchemEditActionErrors.DocOrderComparator

java.lang.Object
  extended by org.dlese.dpc.schemedit.input.SchemEditActionErrors.DocOrderComparator
All Implemented Interfaces:
Comparator
Enclosing class:
SchemEditActionErrors

public class SchemEditActionErrors.DocOrderComparator
extends Object
implements Comparator

Compares two "page error" actionMessages wrt to instance document order so that editing errors can be presented in the same order in which they occur in the document being edited.

"Page error" ActionMessages contain their xpath as the second item of their "values". NOTE: This is dependent on the message resource used to format the errors (see SchemEditValidator & SchemEditErrors).

Algorithm: First compare segment by segment: - if there is indexing info at the given segment, then compare index numbers - if one elment runs out of indexing info before tie is broken, compare by schemaPaths

The SchemaNodeMap.DocOrderComparator can determine schema order of paths, which can be used to order instance document paths, as long as there are no indexes (since indexing information is removed from the schema paths).

If two paths are judged equal by schema order, then they can be simply compared as strings to bring the indexing information in and resolve the tie.

Author:
Jonathan Ostwald

Constructor Summary
SchemEditActionErrors.DocOrderComparator()
           
 
Method Summary
 int compare(Object o1, Object o2)
          sorts by order in which paths are processed by StructureWalker (and therefore are added to the SchemaNodeMap)
 
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
 

Constructor Detail

SchemEditActionErrors.DocOrderComparator

public SchemEditActionErrors.DocOrderComparator()
Method Detail

compare

public int compare(Object o1,
                   Object o2)
sorts by order in which paths are processed by StructureWalker (and therefore are added to the SchemaNodeMap)

Specified by:
compare in interface Comparator
Parameters:
o1 - NOT YET DOCUMENTED
o2 - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

DLESE Tools
v1.6.0