Class SchemEditActionErrors.DocOrderComparator

java.lang.Object
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 invalid input: '&' 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 Details

    • DocOrderComparator

      public DocOrderComparator()
  • Method Details

    • 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