Class PathUtils.PathComparator
java.lang.Object
com.ibm.wsspi.kernel.service.utils.PathUtils.PathComparator
- All Implemented Interfaces:
- Serializable,- Comparator<String>
- Enclosing class:
- PathUtils
public static class PathUtils.PathComparator
extends Object
implements Comparator<String>, Serializable
Comparator for normalized paths.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final charThe separator character for normalized paths.
- 
Constructor SummaryConstructors
- 
Method SummaryMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparatorequals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Field Details- 
PATH_SEPARATORpublic static final char PATH_SEPARATORThe separator character for normalized paths. ('/').- See Also:
 
 
- 
- 
Constructor Details- 
PathComparatorpublic PathComparator()
 
- 
- 
Method Details- 
compareCompare 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- Comparator<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.
 
 
-