Class PathUtils.PathComparator
- java.lang.Object
- 
- com.ibm.wsspi.kernel.service.utils.PathUtils.PathComparator
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.util.Comparator<java.lang.String>
 - Enclosing class:
- PathUtils
 
 public static class PathUtils.PathComparator extends java.lang.Object implements java.util.Comparator<java.lang.String>, java.io.SerializableComparator for normalized paths.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static charPATH_SEPARATORThe separator character for normalized paths.
 - 
Constructor SummaryConstructors Constructor Description PathComparator()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(java.lang.String o1, java.lang.String o2)Compare two relative paths.
 
- 
- 
- 
Field Detail- 
PATH_SEPARATORpublic static final char PATH_SEPARATOR The separator character for normalized paths. ('/').- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
comparepublic int compare(java.lang.String o1, java.lang.String o2)Compare two relative paths. Take into account the presence of path separator characters. That is, the path are compared lists of path segments. The result will be one ofCMP_LT,#CMP_EQ,CMP_GT, or, an integer value which measures the difference between the two path (subtracting the second value from the first), with the sign of the difference indicating the comparison result. In effect:Math.signum(compare(path1, path2)) == Math.signum(path1 - path2)"In effect", because an actual difference between two path values is not defined. This implementation answers the difference between the first characters which do not match, or the differences between the path lengths if all characters of the shorter path match characters of the longer path, or CMP_LT or CMP_GT if slashes are not in the same positions in both paths. For example, "parent/child" is compared as \{ "parent", "child" \}. Then, "parent/child" is less than "parentAlt/child", because "parent" is less than "parentAlt".- Specified by:
- comparein interface- java.util.Comparator<java.lang.String>
- Parameters:
- path1- The first relative path which is to be compared. An exception will result if the path is null.
- path2- The second second path which is to be compared. An exception will result if the path is null.
- Returns:
- A integer value which corresponds to the comparison result. A value less than zero indicates that the first path is less than the second path. A value greater than zero indicates that first path is greater than the second. A value of zero indicates that the two paths are equal.
 
 
- 
 
-