org.nakedobjects.applib.value
Class Time

java.lang.Object
  extended by org.nakedobjects.applib.value.Magnitude
      extended by org.nakedobjects.applib.value.Time
All Implemented Interfaces:
Serializable

public class Time
extends Magnitude

Value object representing a time value.

TODO: other methods to implement:

See Also:
Serialized Form

Field Summary
static int DAY
           
static int HOUR
           
static int MINUTE
           
 
Constructor Summary
Time()
          Create a Time object set to the current time.
Time(Date date)
          Create a Time object for storing a time with the time set to the specified time of the Java Date object.
Time(int hour, int minute)
          Create a Time object for storing a time with the time set to the specified hours and minutes.
 
Method Summary
 Time add(int hours, int minutes)
          Add the specified hours and minutes to this time value, returned as a new Time object.
protected  Time createTime(Date date)
           
protected  Time createTime(int hours, int minutes)
           
 Date dateValue()
           
 boolean equals(Object obj)
           
 int getHour()
           
 int getMinute()
           
 boolean isEqualTo(Magnitude time)
          returns true if the time of this object has the same value as the specified time
 boolean isLessThan(Magnitude time)
          returns true if the time of this object is earlier than the specified time
 long longValue()
          The number of seconds since midnight.
 Time onTheHour()
           
 boolean sameHourAs(Time time)
           
 boolean sameMinuteAs(Time time)
           
 String titleString()
           
 String toString()
           
 
Methods inherited from class org.nakedobjects.applib.value.Magnitude
isBetween, isGreaterThan, isGreaterThanOrEqualTo, isLessThanOrEqualTo, max, min
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MINUTE

public static final int MINUTE
See Also:
Constant Field Values

HOUR

public static final int HOUR
See Also:
Constant Field Values

DAY

public static final int DAY
See Also:
Constant Field Values
Constructor Detail

Time

public Time()
Create a Time object set to the current time.


Time

public Time(int hour,
            int minute)
Create a Time object for storing a time with the time set to the specified hours and minutes.


Time

public Time(Date date)
Create a Time object for storing a time with the time set to the specified time of the Java Date object.

Method Detail

add

public Time add(int hours,
                int minutes)
Add the specified hours and minutes to this time value, returned as a new Time object.


createTime

protected Time createTime(int hours,
                          int minutes)

createTime

protected Time createTime(Date date)

dateValue

public Date dateValue()

equals

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

getHour

public int getHour()

getMinute

public int getMinute()

isEqualTo

public boolean isEqualTo(Magnitude time)
returns true if the time of this object has the same value as the specified time

Specified by:
isEqualTo in class Magnitude

isLessThan

public boolean isLessThan(Magnitude time)
returns true if the time of this object is earlier than the specified time

Specified by:
isLessThan in class Magnitude

longValue

public long longValue()
The number of seconds since midnight.


titleString

public String titleString()

toString

public String toString()
Overrides:
toString in class Object

sameHourAs

public boolean sameHourAs(Time time)

sameMinuteAs

public boolean sameMinuteAs(Time time)

onTheHour

public Time onTheHour()


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.