net.sf.marineapi.nmea.util
Class Time

java.lang.Object
  extended by net.sf.marineapi.nmea.util.Time

public class Time
extends Object

Represents a time of day in 24-hour clock, i.e. the UTC time used as default in NMEA 0183. Transmitted by TimeSentence.

Version:
$Revision: 104 $
Author:
Kimmo Tuukkanen
See Also:
TimeSentence, Date

Constructor Summary
Time()
          Creates a new instance of Time using the current system time.
Time(int hour, int min, double sec)
          Creates a new instance of Time.
 
Method Summary
 boolean equals(Object obj)
           
 int getHour()
          Get the hour of day.
 long getMilliseconds()
          Get time as milliseconds since beginning of day.
 int getMinutes()
          Get the minute of hour.
 double getSeconds()
          Get the second of minute.
 int hashCode()
           
 void setHour(int hour)
          Set the hour of day.
 void setMinutes(int minutes)
          Set the minute of hour.
 void setSeconds(double seconds)
          Set seconds of minute.
 void setTime(Date d)
          Set the time values from specified Date.
 Date toDate(Date d)
          Convert to Date.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Time

public Time()
Creates a new instance of Time using the current system time.


Time

public Time(int hour,
            int min,
            double sec)
Creates a new instance of Time.

Parameters:
hour - Hour of day
min - Minute of hour
sec - Second of minute
Method Detail

equals

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

getHour

public int getHour()
Get the hour of day.

Returns:
the hour

getMilliseconds

public long getMilliseconds()
Get time as milliseconds since beginning of day.

Returns:
Milliseconds

getMinutes

public int getMinutes()
Get the minute of hour.

Returns:
the minute

getSeconds

public double getSeconds()
Get the second of minute.

Returns:
the second

hashCode

public int hashCode()
Overrides:
hashCode in class Object

setHour

public void setHour(int hour)
Set the hour of day.

Parameters:
hour - the hour to set
Throws:
IllegalArgumentException - If hour value out of bounds 0..23

setMinutes

public void setMinutes(int minutes)
Set the minute of hour.

Parameters:
minutes - the minute to set
Throws:
IllegalArgumentException - If minutes value out of bounds 0..59

setSeconds

public void setSeconds(double seconds)
Set seconds of minute.

Parameters:
seconds - the seconds to set
Throws:
IllegalArgumentException - If seconds value out of bounds 0..59

setTime

public void setTime(Date d)
Set the time values from specified Date. The date information of is ignored, only hours, minutes and seconds are relevant.

Parameters:
d - Date

toDate

public Date toDate(Date d)
Convert to Date.

Parameters:
d - Date that defines year, month and day for time.
Returns:
A Date that is combination of specified Date and Time

toString

public String toString()
Overrides:
toString in class Object


Copyright (C) 2010-2011 Java Marine API author(s). All Rights Reserved.