Holger's
Java API

com.antelmann.calendar
Class CalendarEntry

java.lang.Object
  extended by com.antelmann.calendar.CalendarEntry
All Implemented Interfaces:
Serializable

public class CalendarEntry
extends Object
implements Serializable

represents a generic entry in a calendar

Author:
Holger Antelmann
See Also:
Serialized Form

Field Summary
protected  HashSet<String> categories
           
protected  Properties properties
           
protected  Recurrence recurrence
           
static Comparator<CalendarEntry> standardComparator
          compares first on time and then on title
 
Constructor Summary
CalendarEntry(int id, CalendarEntry entry)
          creates a dublicate from entry where only the id is different from the original
CalendarEntry(int id, Date begin, Date end, String title)
          begin and title must not be null
CalendarEntry(int id, Date begin, Date end, String title, String location, String description)
          begin and title must not be null
CalendarEntry(int id, Date begin, long duration, String title)
          begin and title must not be null
CalendarEntry(int id, Date begin, long durationMillis, String title, String location, String description)
          begin and title must not be null
 
Method Summary
 boolean addCategory(String category)
           
 long creationTime()
           
 boolean deepCompare(CalendarEntry entry)
          checks whether all: title, begin date and location are equal.
 boolean equals(Object obj)
          merely checks the id
 Date getBegin()
           
 String[] getCategories()
           
 String getDescription()
           
 long getDuration()
          time in milliseconds
 Date getEnd()
           
 int getID()
           
 String getLocation()
           
 Object getProperty(Object key)
           
 Object getProperty(Object key, Object defaultValue)
           
 Set<Object> getPropertyKeys()
           
 Recurrence getRecurrence()
           
 Date[] getRecurrences(Date after, Date before)
          may return null if no recurrence is set.
 String getTitle()
           
 boolean hasCategory(String category)
           
 int hashCode()
          based on the id
 boolean isCanceled()
           
 boolean isConfirmed()
           
 long lastUpdated()
           
 boolean overlapsWith(CalendarEntry entry)
           
 boolean removeCategory(String category)
           
 Object removeProperty(Object key)
           
 boolean sameDay(Date date)
          returns true if the given date is on the same day as the begin time of this entry
 void setBegin(Date begin)
          setting the begin also alters the end, as the duration remains
 void setCanceled(boolean flag)
           
 void setConfirmed(boolean flag)
           
 void setDescription(String desc)
           
 void setDuration(long millis)
           
protected  void setID(int id)
           
 void setLocation(String location)
           
 Object setProperty(Object property, Object value)
           
 void setRecurrence(Recurrence r)
           
 void setTitle(String title)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

standardComparator

public static final Comparator<CalendarEntry> standardComparator
compares first on time and then on title


categories

protected HashSet<String> categories

properties

protected Properties properties

recurrence

protected Recurrence recurrence
Constructor Detail

CalendarEntry

public CalendarEntry(int id,
                     Date begin,
                     Date end,
                     String title)
begin and title must not be null


CalendarEntry

public CalendarEntry(int id,
                     Date begin,
                     long duration,
                     String title)
begin and title must not be null


CalendarEntry

public CalendarEntry(int id,
                     Date begin,
                     Date end,
                     String title,
                     String location,
                     String description)
begin and title must not be null


CalendarEntry

public CalendarEntry(int id,
                     Date begin,
                     long durationMillis,
                     String title,
                     String location,
                     String description)
begin and title must not be null


CalendarEntry

public CalendarEntry(int id,
                     CalendarEntry entry)
creates a dublicate from entry where only the id is different from the original

Method Detail

getID

public int getID()

setID

protected void setID(int id)

creationTime

public long creationTime()

lastUpdated

public long lastUpdated()

getBegin

public Date getBegin()

setBegin

public void setBegin(Date begin)
setting the begin also alters the end, as the duration remains


getEnd

public Date getEnd()

getDuration

public long getDuration()
time in milliseconds


setDuration

public void setDuration(long millis)

getTitle

public String getTitle()

setTitle

public void setTitle(String title)

getLocation

public String getLocation()

setLocation

public void setLocation(String location)

getDescription

public String getDescription()

isConfirmed

public boolean isConfirmed()

isCanceled

public boolean isCanceled()

setDescription

public void setDescription(String desc)

setConfirmed

public void setConfirmed(boolean flag)

setCanceled

public void setCanceled(boolean flag)

addCategory

public boolean addCategory(String category)

removeCategory

public boolean removeCategory(String category)

hasCategory

public boolean hasCategory(String category)

getCategories

public String[] getCategories()

setProperty

public Object setProperty(Object property,
                          Object value)

getProperty

public Object getProperty(Object key)

removeProperty

public Object removeProperty(Object key)

getProperty

public Object getProperty(Object key,
                          Object defaultValue)

getPropertyKeys

public Set<Object> getPropertyKeys()

getRecurrence

public Recurrence getRecurrence()

setRecurrence

public void setRecurrence(Recurrence r)

getRecurrences

public Date[] getRecurrences(Date after,
                             Date before)
                      throws IllegalArgumentException
may return null if no recurrence is set.

Parameters:
after - must come before the second parameter
before - must come after the first parameter
Throws:
IllegalArgumentException

equals

public boolean equals(Object obj)
merely checks the id

Overrides:
equals in class Object

hashCode

public int hashCode()
based on the id

Overrides:
hashCode in class Object

deepCompare

public boolean deepCompare(CalendarEntry entry)
checks whether all: title, begin date and location are equal.


toString

public String toString()
Overrides:
toString in class Object

overlapsWith

public boolean overlapsWith(CalendarEntry entry)

sameDay

public boolean sameDay(Date date)
returns true if the given date is on the same day as the begin time of this entry



(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads