Package gov.nih.mipav.model.file
Class FilenameSorter
java.lang.Object
gov.nih.mipav.model.file.FilenameSorter
- All Implemented Interfaces:
Comparator<String>
DOCUMENT ME!
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanThis method determines whether two String objects have the same characters up to the beginning index of the last numerical sequence of numerals.intstatic intcompareToLastNumericalSequence(String str1, String str2) The purpose of this method is to compare two filename strings on the basis of their last numerical sequence.extractSubSets(String[] filenames) This method will take a String array parameter and break it into a Vector of Vectors.static intAlternative to lastNumericalSequenceBegin(String, int), this method should be called if you don't already have the index of the end of the last numerical sequence in the String parameter.static intlastNumericalSequenceBegin(String str, int lastNumSequenceEnd) The purpose of this method is to find the index location of a String that is the beginning of the last numerical sequence.static intThe purpose of this method is to find the index location of a String that is the end of the last numerical sequence.secondarySort(Vector<Vector<String>> vector) This method takes a sorted Vector of Vectors as a parameter.static String[]subSetsToArray(Vector<Vector<String>> vector) Method will convert a Vector of Vectors of String into a String array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
FilenameSorter
public FilenameSorter()
-
-
Method Details
-
commonSet
This method determines whether two String objects have the same characters up to the beginning index of the last numerical sequence of numerals.- Parameters:
str1- DOCUMENT ME!str2- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
compareToLastNumericalSequence
The purpose of this method is to compare two filename strings on the basis of their last numerical sequence. For example, the filenames "dicom84.dcm" and "dicom83.dcm" will be compared to each other on the numbers 83 and 84.- Parameters:
str1- Stringstr2- String- Returns:
- int
-
extractSubSets
This method will take a String array parameter and break it into a Vector of Vectors. The encompassing Vector will hold references to Vectors of String, which should represent a set of related data. The related data is meant to have the same characters up until the beginning index of the last numerical sequence of numerals.- Parameters:
filenames- String[]- Returns:
- Vector
-
lastNumericalSequenceBegin
Alternative to lastNumericalSequenceBegin(String, int), this method should be called if you don't already have the index of the end of the last numerical sequence in the String parameter.- Parameters:
str- String- Returns:
- int
-
lastNumericalSequenceBegin
The purpose of this method is to find the index location of a String that is the beginning of the last numerical sequence. For example, when passed the string "dicom84.dcm" the method will return 5.- Parameters:
str- StringlastNumSequenceEnd- int- Returns:
- int
-
lastNumericalSequenceEnd
The purpose of this method is to find the index location of a String that is the end of the last numerical sequence. For example, when passed the string "dicom84.dcm" this method will return 6.- Parameters:
str- String- Returns:
- int
-
secondarySort
This method takes a sorted Vector of Vectors as a parameter. The encompassing Vector holds references to Vectors of a particular set of Strings. These sets are sorted based on their last numerical sequence of numerals. The rearranged Vector is then returned.- Parameters:
vector- Vector- Returns:
- Vector
-
subSetsToArray
Method will convert a Vector of Vectors of String into a String array.- Parameters:
vector- Vector- Returns:
- String[]
-
compare
- Specified by:
comparein interfaceComparator<String>
-