com.redcarton.alarmclock
Class Alarm

java.lang.Object
  extended bycom.redcarton.alarmclock.Alarm
All Implemented Interfaces:
ChangeListener, EventListener

public class Alarm
extends Object
implements ChangeListener

Version:
1.0 2005-03-07
Author:
Dominique Bischof

Constructor Summary
Alarm(AlarmListener listener, boolean twentyFourHourFormat)
          Instantiates a new instance of Alarm.
Alarm(AlarmListener listener, boolean twentyFourHourFormat, int hours, int minutes)
          Instantiates a new instance of Alarm with a default time.
 
Method Summary
 int getHours()
          Returns the alarm hour in the appropriate format (24hr or 12hr).
 int getMinutes()
          Returns the alarm minutes from 0 through 59.
 JSlider getSlider()
          Returns a slider for setting the alarm time.
 boolean isAm()
          Returns whether the alarm is in the AM.
 boolean isTwentyFourHourFormat()
          Returns whether the alarm's display should be in 24hr format.
 void snooze()
          Snoozes the alarm.
 void stateChanged(ChangeEvent e)
          Do not call directly.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Alarm

public Alarm(AlarmListener listener,
             boolean twentyFourHourFormat)
Instantiates a new instance of Alarm.

Parameters:
twentyFourHourFormat - true if it is in 24hr format, false if it is in 12hr format

Alarm

public Alarm(AlarmListener listener,
             boolean twentyFourHourFormat,
             int hours,
             int minutes)
Instantiates a new instance of Alarm with a default time.

Parameters:
twentyFourHourFormat - true if it is in 24hr format, false if it is in 12hr format
hours - the hour in 24hr format
minutes - the minutes
Method Detail

getHours

public int getHours()
Returns the alarm hour in the appropriate format (24hr or 12hr). Returns 0 through 23 in 24hr format, 1 through 12 in 12hr format.

Returns:
the hours

getMinutes

public int getMinutes()
Returns the alarm minutes from 0 through 59.

Returns:
the minutes

getSlider

public JSlider getSlider()
Returns a slider for setting the alarm time.

Returns:
the slider

isAm

public boolean isAm()
Returns whether the alarm is in the AM.

Returns:
true if it is in the AM, false if it is in the PM

isTwentyFourHourFormat

public boolean isTwentyFourHourFormat()
Returns whether the alarm's display should be in 24hr format.

Returns:
true if it is in 24hr format, false if it is in 12hr format

snooze

public void snooze()
Snoozes the alarm. The alarm will ring again once the snooze is over.


stateChanged

public void stateChanged(ChangeEvent e)
Do not call directly. Called when the slider is slid.

Specified by:
stateChanged in interface ChangeListener