package FolderSplit;

import java.util.Comparator;

public enum FileSorter implements Comparator<FileInfo> {
    Name {
        @Override
        public int compare(FileInfo o1, FileInfo o2) {
            return o1.name.compareTo(o2.name);
        }
    },
    Extension {
        @Override
        public int compare(FileInfo o1, FileInfo o2) {
            return o1.getExtension().compareTo(o2.getExtension());
        }
    },
    Size {
        @Override
        public int compare(FileInfo o1, FileInfo o2) {
            return (int) Math.signum(o1.size - o2.size);
        }
    },
    Modification {
        @Override
        public int compare(FileInfo o1, FileInfo o2) {
            return o1.modified.compareTo(o2.modified);
        }
    };
}
