com.mindprod.holidays
Class HolidaySort

java.lang.Object
  extended by com.mindprod.holidays.HolidaySort
All Implemented Interfaces:
java.util.Comparator<HolInfo>

 class HolidaySort
extends java.lang.Object
implements java.util.Comparator<HolInfo>

Sort by date holiday occurs in a specified year.

Defines an alternate sort order for HolInfo.

Since:
2008
Version:
1.0 2008-03-20 initial version
Author:
Roedy Green, Canadian Mind Products

Constructor Summary
HolidaySort(int year, boolean shifted)
          constructor sort holidays in order for a given year.
 
Method Summary
 int compare(HolInfo a, HolInfo b)
          Sort by date holiday occurs in a specified year.
 
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
 

Constructor Detail

HolidaySort

HolidaySort(int year,
            boolean shifted)
constructor sort holidays in order for a given year.

Parameters:
year - which year of interest. Holidays change order in different years.
shifted - true if want to sort by shifted-date you get off work..
Method Detail

compare

public final int compare(HolInfo a,
                         HolInfo b)
Sort by date holiday occurs in a specified year. Defines an alternate sort order for HolInfo. Compare two HolInfo Objects. Informally, returns (a-b), or +ve if a is more positive than b.

Specified by:
compare in interface java.util.Comparator<HolInfo>
Parameters:
a - first HolInfo to compare
b - second HolInfo to compare
Returns:
+ve if a>b, 0 if a==b, -ve if a<b