com.jstatcom.util
Class ComparatorTypes

java.lang.Object
  extended by com.jstatcom.util.ComparatorTypes
All Implemented Interfaces:
java.util.Comparator<java.lang.Object>

public abstract class ComparatorTypes
extends java.lang.Object
implements java.util.Comparator<java.lang.Object>

This class contains comparators that can be reused by other classes.

It implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21) . If you compare ComparatorTypes, always use the == operator. This is save, because they are Singletons (Gamma et al., 1995) .

Author:
Markus Kraetzig

Field Summary
static ComparatorTypes STRING_DEFAULT
          Compares two strings regardless of their case.
 
Method Summary
 boolean equals(java.lang.Object o)
          Override prevention method to enforce a.equals(b) if and only if a==b.
 int hashCode()
          Override prevention method invokes super method.
 java.lang.String toString()
          Returns a string representation of this type, do not use for comparisons.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
compare
 

Field Detail

STRING_DEFAULT

public static final ComparatorTypes STRING_DEFAULT
Compares two strings regardless of their case.

Method Detail

equals

public final boolean equals(java.lang.Object o)
Override prevention method to enforce a.equals(b) if and only if a==b.

Specified by:
equals in interface java.util.Comparator<java.lang.Object>
Overrides:
equals in class java.lang.Object
Parameters:
o - object to compare with
Returns:
true if mainPeriod, subPeriod and subPeriodicity are the same, false otherwise

hashCode

public final int hashCode()
Override prevention method invokes super method.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code

toString

public final java.lang.String toString()
Returns a string representation of this type, do not use for comparisons.

Overrides:
toString in class java.lang.Object
Returns:
String representation of this object.