metab
Class DrinkTime

java.lang.Object
  extended bymetab.DrinkTime
All Implemented Interfaces:
java.io.Serializable

public class DrinkTime
extends java.lang.Object
implements java.io.Serializable

The DrinkTime class has use only in containing a time of day. It does not specify a date for simplicity. It relies on hours, minutes, and a 12-hour (non-military) clock to hold the time. This class was designed instead of using the Date-types because neither milliseconds nor specific dates were required.

Version:
1.03
Author:
Levi Blackstone, Matthew Woller
See Also:
Serialized Form

Field Summary
static int _AM
          Standard value representing AM hours.
static int _PM
          Standard value representing PM hours.
private  int AMorPM
          Specifies whether time is AM or PM.
private  int hours
          Number of hours.
private  int minutes
          Number of minutes.
 
Constructor Summary
(package private) DrinkTime(int hours, int minutes, int AMorPM)
          Constructor for DrinkTime class.
 
Method Summary
 int getAMorPM()
          Retrieves 12-hour format information.
 DrinkTime getCopy()
          Retrieves a copy of time encompassing drinking period.
 int getHours()
          Retrieves number of hours.
 int getMinutes()
          Retrieves number of minutes.
 void setAMorPM(int AMorPM)
          Sets whether time is AM or PM.
 void setHours(int hours)
          Sets number of hours.
 void setMinutes(int minutes)
          Sets number of minutes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_AM

public static final int _AM
Standard value representing AM hours.

See Also:
Constant Field Values

_PM

public static final int _PM
Standard value representing PM hours.

See Also:
Constant Field Values

hours

private int hours
Number of hours.


minutes

private int minutes
Number of minutes.


AMorPM

private int AMorPM
Specifies whether time is AM or PM.

Constructor Detail

DrinkTime

DrinkTime(int hours,
          int minutes,
          int AMorPM)
Constructor for DrinkTime class.

Parameters:
hours - Number of hours.
minutes - Number of minutes.
AMorPM - Specifies whether time is AM or PM.
Method Detail

getHours

public int getHours()
Retrieves number of hours.

Returns:
int representing number of hours.

getMinutes

public int getMinutes()
Retrieves number of minutes.

Returns:
int representing number of minutes.

getAMorPM

public int getAMorPM()
Retrieves 12-hour format information.

Returns:
int representing whether time is AM or PM.

getCopy

public DrinkTime getCopy()
Retrieves a copy of time encompassing drinking period.

Returns:
DrinkTime representing new instance of current time.

setHours

public void setHours(int hours)
Sets number of hours.

Parameters:
hours - Number of hours.

setMinutes

public void setMinutes(int minutes)
Sets number of minutes.

Parameters:
minutes - Number of minutes.

setAMorPM

public void setAMorPM(int AMorPM)
Sets whether time is AM or PM.

Parameters:
AMorPM - Specifies whether time is AM or PM.