Package org.spdx.tools.compare
Class NormalizedFileNameComparator
java.lang.Object
org.spdx.tools.compare.NormalizedFileNameComparator
- All Implemented Interfaces:
Serializable
,Comparator<Optional<String>>
public class NormalizedFileNameComparator extends Object implements Comparator<Optional<String>>, Serializable
Compares to file name strings normalizing them to a common format using the following rules:
- File separator character is "/"
- Must begin with "./"
- Author:
- Gary O'Neall
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description NormalizedFileNameComparator()
-
Method Summary
Modifier and Type Method Description int
compare(Optional<String> fileName1, Optional<String> fileName2)
static boolean
hasLeadingDir(String fileName1, String fileName2)
Returns true if fileName2 matches fileName1 except for leading file name directoriesstatic String
normalizeFileName(Optional<String> fileName)
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, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
NormalizedFileNameComparator
public NormalizedFileNameComparator()
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<Optional<String>>
-
hasLeadingDir
Returns true if fileName2 matches fileName1 except for leading file name directories- Parameters:
fileName1
-fileName2
-- Returns:
- true if fileName2 matches fileName1 except for leading file name directories
-
normalizeFileName
-