Package adams.core.io

Class FileObjectComparator

    • Field Detail

      • m_CaseSensitive

        protected boolean m_CaseSensitive
        whether to perform case-sensitive comparisons.
      • m_ListDirsFirst

        protected boolean m_ListDirsFirst
        whether to list directoris first.
      • m_IncludeParentDirs

        protected boolean m_IncludeParentDirs
        whether to include parent directories in sorting.
    • Constructor Detail

      • FileObjectComparator

        public FileObjectComparator​(boolean caseSensitive,
                                    boolean listDirsFirst,
                                    boolean includeParentDirs)
        Initializes the comparator.
        Parameters:
        caseSensitive - true if to perform case-sensitive comparisons
        listDirsFirst - whether to list directories first or to mix them in with files
        includeParentDirs - whether to include parent directories in the comparison
    • Method Detail

      • isCaseSensitive

        public boolean isCaseSensitive()
        Returns whether comparison is case-sensitive.
        Returns:
        true if case-sensitive
      • isListDirsFirst

        public boolean isListDirsFirst()
        Returns whether to list directories first.
        Returns:
        true if to list dirs first
      • isIncludeParentDirs

        public boolean isIncludeParentDirs()
        Returns whether to include parent directories in the comparison.
        Returns:
        true if included
      • compare

        public int compare​(FileObject o1,
                           FileObject o2)
        Compares the two file wrappers.
        Specified by:
        compare in interface Comparator<FileObject>
        Parameters:
        o1 - the first wrapper
        o2 - the second wrapper
        Returns:
        less than, equal to or greater than zero if the first wrapper is less than, equal to or greater than the second one.