se.entitymanager.logic.file
Class FileComparator

java.lang.Object
  extended by se.entitymanager.logic.file.FileComparator
All Implemented Interfaces:
java.util.Comparator

public class FileComparator
extends java.lang.Object
implements java.util.Comparator

A Comparator for files.

First sort criteria is whether entity is instance of DirectoryFile . second criteria is name.


Field Summary
(package private)  EntityByNameComparator entityByNameComparator
          Comparator used for name comparison.
 
Constructor Summary
protected FileComparator()
          Constructs a file comparator.
 
Method Summary
 int compare(java.lang.Object entity1, java.lang.Object entity2)
          Compares its two arguments for order.
 
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
 

Field Detail

entityByNameComparator

EntityByNameComparator entityByNameComparator
Comparator used for name comparison.

Constructor Detail

FileComparator

protected FileComparator()
Constructs a file comparator.

Method Detail

compare

public int compare(java.lang.Object entity1,
                   java.lang.Object entity2)
Compares its two arguments for order.

The two arguments must be instances derived from AbstractFile.

Specified by:
compare in interface java.util.Comparator
Parameters:
entity1 - the first file to be compared
entity2 - the second file to be compared
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.