SalesPoint Framework v3.0

sale
Class StepTimer

java.lang.Object
  |
  +--sale.StepTimer
Direct Known Subclasses:
AutoTimer

public class StepTimer
extends Object
implements Timer

This is a rather simple implementation of the Timer interface.

It requires a Time object to work with. Every increasing of the timer has to be explicitly triggered by the goAhead() method.

Hooks:
Select Timer Type
Since:
v2.0
Version:
2.0 11/06/1999
Author:
Stephan Gambke
See Also:
Serialized Form

Field Summary
protected  ListenerHelper m_lhListeners
          The listeners registered with this timer.
protected  Time m_tTime
          The current Time.
 
Constructor Summary
StepTimer()
          Create a new timer wich uses an instance of Step as the time object.
StepTimer(Time tTimeObject)
          Create a new timer wich uses the given Time object.
 
Method Summary
 void addTimerListener(TimerListener tlListener)
          Add a TimerListener which will receive TimerEvents triggered by this timer.
protected  void fireGoneAhead()
          Fire a goneAhead event.
protected  void fireIntervalSet()
          Fire an intervalSet event.
protected  void fireTimeSet()
          Fire a timeSet event.
 Object getInterval()
          Get the current interval.
 Object getTime()
          Get the current time.
 Comparable getTimeStamp()
          Create and return a fresh time stamp.
 void goAhead()
          Increase the time by the current interval.
 void removeTimerListener(TimerListener tlListener)
          Remove the given TimerListener.
 void setInterval(Object oInterval)
          Set the interval to be used by the goAhead() method.
 void setTime(Object oTime)
          Set the time and fire a timeSet event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_tTime

protected Time m_tTime
The current Time.

m_lhListeners

protected ListenerHelper m_lhListeners
The listeners registered with this timer.
Constructor Detail

StepTimer

public StepTimer()
Create a new timer wich uses an instance of Step as the time object.

StepTimer

public StepTimer(Time tTimeObject)
Create a new timer wich uses the given Time object.
Parameters:
tTimeObject - the time object to use
Method Detail

setTime

public void setTime(Object oTime)
             throws IllegalArgumentException
Set the time and fire a timeSet event.

The time has to be in a format that can be processed by the Time object.

Override:
Never.
Specified by:
setTime in interface Timer
Parameters:
oTime - the time to set
Throws:
IllegalArgumentException - if the set time does not meet the time object's class or format requirements

getTime

public Object getTime()
Get the current time. This is delegated to the Time object.
Override:
Never.
Specified by:
getTime in interface Timer
Returns:
an Object representing the current time, the exact type depends on the time object

setInterval

public void setInterval(Object oInterval)
Set the interval to be used by the goAhead() method.

The given interval has to be of a proper type to be used with the time object's goAhead() method.

Override:
Never.
Specified by:
setInterval in interface Timer
Parameters:
oInterval - the interval to be used

getInterval

public Object getInterval()
Get the current interval.
Override:
Never.
Specified by:
getInterval in interface Timer
Returns:
an Object representing the current interval

addTimerListener

public void addTimerListener(TimerListener tlListener)
Add a TimerListener which will receive TimerEvents triggered by this timer.
Override:
Never.
Specified by:
addTimerListener in interface Timer
Parameters:
tlListener - the listener to be registered.

removeTimerListener

public void removeTimerListener(TimerListener tlListener)
Remove the given TimerListener.
Override:
Never.
Specified by:
removeTimerListener in interface Timer
Parameters:
tlListener - the listener to be deregistered.

goAhead

public void goAhead()
             throws IllegalArgumentException
Increase the time by the current interval.

If no interval has been set yet, the interval given by the Time.getDefaultInterval() method of the time object is used.

Override:
Never.
Specified by:
goAhead in interface Timer
Throws:
IllegalArgumentException - if the interval does not meet the time object's class or format requirements

getTimeStamp

public Comparable getTimeStamp()
Create and return a fresh time stamp.
Override:
Never.
Specified by:
getTimeStamp in interface Timer
Returns:
a fresh time stamp.

fireTimeSet

protected void fireTimeSet()
Fire a timeSet event.
Override:
Never.

fireIntervalSet

protected void fireIntervalSet()
Fire an intervalSet event.
Override:
Never.

fireGoneAhead

protected void fireGoneAhead()
Fire a goneAhead event.
Override:
Never.

SalesPoint Framework v3.0