org.jboss.cache
Class FqnComparator

java.lang.Object
  extended by org.jboss.cache.FqnComparator
All Implemented Interfaces:
java.util.Comparator<Fqn>

@Immutable
public class FqnComparator
extends java.lang.Object
implements java.util.Comparator<Fqn>

Compares the order of two FQN. Sorts by name, then by depth, e.g.

 aaa/bbb
 xxx
 xxx/ccc
 

Author:
Manik Surtani (manik@jboss.org), Steve Woodcock (stevew@jofti.com)

Field Summary
static FqnComparator INSTANCE
           
 
Constructor Summary
FqnComparator()
          Sorts by name, then depth.
 
Method Summary
 int compare(Fqn fqn1, Fqn fqn2)
          Returns -1 if the first comes before; 0 if they are the same; 1 if the second Fqn comes before.
 
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

INSTANCE

public static final FqnComparator INSTANCE
Constructor Detail

FqnComparator

public FqnComparator()
Sorts by name, then depth.

Method Detail

compare

public int compare(Fqn fqn1,
                   Fqn fqn2)
Returns -1 if the first comes before; 0 if they are the same; 1 if the second Fqn comes before. null always comes first.

Specified by:
compare in interface java.util.Comparator<Fqn>