edu.cmu.andrew.icalendar
Class EventComparator

java.lang.Object
  |
  +--edu.cmu.andrew.icalendar.EventComparator
All Implemented Interfaces:
Comparator
Direct Known Subclasses:
EventComparator.SortByCreationDate, EventComparator.SortByOwningAgenda, EventComparator.SortByStartDate, EventComparator.SortBySummary

public abstract class EventComparator
extends Object
implements Comparator

Implementation of Comparator for use with Event objects. Useful for doing such things as putting events in java.util.TreeMap and other collections that need to compare objects on insertion.

Author:
miles

Inner Class Summary
protected static class EventComparator.SortByCreationDate
           
protected static class EventComparator.SortByOwningAgenda
           
protected static class EventComparator.SortByStartDate
           
protected static class EventComparator.SortBySummary
           
 
Field Summary
private static int EQUAL
           
private static int FIRST_GREATER_THAN
           
private static int FIRST_LESS_THAN
           
static int SORT_BY_CREATION_DATE
           
static int SORT_BY_OWNING_AGENDA
           
static int SORT_BY_START_DATE_INSTANCE
           
static int SORT_BY_SUMMARY
           
 
Constructor Summary
EventComparator()
           
 
Method Summary
abstract  int compare(Object o1, Object o2)
           
abstract  boolean equals(Object obj)
           
static EventComparator getInstance()
           
static EventComparator getInstance(int type)
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

SORT_BY_START_DATE_INSTANCE

public static final int SORT_BY_START_DATE_INSTANCE

SORT_BY_OWNING_AGENDA

public static final int SORT_BY_OWNING_AGENDA

SORT_BY_SUMMARY

public static final int SORT_BY_SUMMARY

SORT_BY_CREATION_DATE

public static final int SORT_BY_CREATION_DATE

FIRST_LESS_THAN

private static final int FIRST_LESS_THAN

EQUAL

private static final int EQUAL

FIRST_GREATER_THAN

private static final int FIRST_GREATER_THAN
Constructor Detail

EventComparator

public EventComparator()
Method Detail

compare

public abstract int compare(Object o1,
                            Object o2)
                     throws ClassCastException
Specified by:
compare in interface Comparator

equals

public abstract boolean equals(Object obj)
Specified by:
equals in interface Comparator
Overrides:
equals in class Object

getInstance

public static EventComparator getInstance()

getInstance

public static EventComparator getInstance(int type)
                                   throws IllegalArgumentException