Class FilenameSorter

  • All Implemented Interfaces:
    java.util.Comparator<java.lang.String>

    public class FilenameSorter
    extends java.lang.Object
    implements java.util.Comparator<java.lang.String>
    DOCUMENT ME!
    • Constructor Summary

      Constructors 
      Constructor Description
      FilenameSorter()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean commonSet​(java.lang.String str1, java.lang.String str2)
      This method determines whether two String objects have the same characters up to the beginning index of the last numerical sequence of numerals.
      int compare​(java.lang.String arg0, java.lang.String arg1)  
      static int compareToLastNumericalSequence​(java.lang.String str1, java.lang.String str2)
      The purpose of this method is to compare two filename strings on the basis of their last numerical sequence.
      static java.util.Vector<java.util.Vector<java.lang.String>> extractSubSets​(java.lang.String[] filenames)
      This method will take a String array parameter and break it into a Vector of Vectors.
      static int lastNumericalSequenceBegin​(java.lang.String str)
      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.
      static int lastNumericalSequenceBegin​(java.lang.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 int lastNumericalSequenceEnd​(java.lang.String str)
      The purpose of this method is to find the index location of a String that is the end of the last numerical sequence.
      static java.util.Vector<java.util.Vector<java.lang.String>> secondarySort​(java.util.Vector<java.util.Vector<java.lang.String>> vector)
      This method takes a sorted Vector of Vectors as a parameter.
      static java.lang.String[] subSetsToArray​(java.util.Vector<java.util.Vector<java.lang.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, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • FilenameSorter

        public FilenameSorter()
    • Method Detail

      • commonSet

        public static boolean commonSet​(java.lang.String str1,
                                        java.lang.String str2)
        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

        public static int compareToLastNumericalSequence​(java.lang.String str1,
                                                         java.lang.String str2)
        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 - String
        str2 - String
        Returns:
        int
      • extractSubSets

        public static java.util.Vector<java.util.Vector<java.lang.String>> extractSubSets​(java.lang.String[] filenames)
        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

        public static int lastNumericalSequenceBegin​(java.lang.String str)
        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

        public static int lastNumericalSequenceBegin​(java.lang.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. For example, when passed the string "dicom84.dcm" the method will return 5.
        Parameters:
        str - String
        lastNumSequenceEnd - int
        Returns:
        int
      • lastNumericalSequenceEnd

        public static int lastNumericalSequenceEnd​(java.lang.String str)
        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

        public static java.util.Vector<java.util.Vector<java.lang.String>> secondarySort​(java.util.Vector<java.util.Vector<java.lang.String>> vector)
        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

        public static java.lang.String[] subSetsToArray​(java.util.Vector<java.util.Vector<java.lang.String>> vector)
        Method will convert a Vector of Vectors of String into a String array.
        Parameters:
        vector - Vector
        Returns:
        String[]
      • compare

        public int compare​(java.lang.String arg0,
                           java.lang.String arg1)
        Specified by:
        compare in interface java.util.Comparator<java.lang.String>