Holger's
Java API

com.antelmann.calendar
Class TimeInDay

java.lang.Object
  extended by com.antelmann.calendar.TimeInDay
All Implemented Interfaces:
Serializable, Comparable<TimeInDay>

public class TimeInDay
extends Object
implements Serializable, Comparable<TimeInDay>

represents the time of the day of any given date. For String representation, it uses the format H:mm.

Since:
Feb 2006
Author:
Holger Antelmann
See Also:
SimpleDateFormat, Serialized Form

Field Summary
protected static SimpleDateFormat format
          the format used to convert between TimeInDay and String
 
Constructor Summary
TimeInDay()
          uses the current time
TimeInDay(Date time)
          takes the time of the day from the given time
TimeInDay(int timeInDay)
          time in milliseconds from 12:00 am (must be less than 24h)
TimeInDay(String hourString)
           
 
Method Summary
 boolean after(Date time)
           
 boolean after(TimeInDay time)
           
 boolean before(Date time)
           
 boolean before(TimeInDay time)
           
 int compareTo(TimeInDay time)
           
 boolean equals(Object obj)
           
 Date getDate(Date inDay)
          returns the date that is calculated by taking the beginning of the given day and adds this TimeInDay's value.
 int getTime()
           
 int hashCode()
           
static TimeInDay parse(String s)
           
 void setTime(int timeInDay)
          takes time in milliseconds from 12:00 am (must be less than 24h)
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

format

protected static final SimpleDateFormat format
the format used to convert between TimeInDay and String

Constructor Detail

TimeInDay

public TimeInDay()
uses the current time


TimeInDay

public TimeInDay(Date time)
takes the time of the day from the given time


TimeInDay

public TimeInDay(int timeInDay)
time in milliseconds from 12:00 am (must be less than 24h)


TimeInDay

public TimeInDay(String hourString)
          throws ParseException
Throws:
ParseException
Method Detail

setTime

public void setTime(int timeInDay)
takes time in milliseconds from 12:00 am (must be less than 24h)


getDate

public Date getDate(Date inDay)
returns the date that is calculated by taking the beginning of the given day and adds this TimeInDay's value.


before

public boolean before(TimeInDay time)

after

public boolean after(TimeInDay time)

before

public boolean before(Date time)

after

public boolean after(Date time)

getTime

public int getTime()

compareTo

public int compareTo(TimeInDay time)
Specified by:
compareTo in interface Comparable<TimeInDay>

parse

public static TimeInDay parse(String s)
                       throws ParseException
Throws:
ParseException

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


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