SalesPoint Framework v3.0

sale
Interface Timer

All Known Implementing Classes:
StepTimer

public interface Timer
extends Serializable

An object that is to be able to do the time management for your application has to implement this interface.

It is intended and therefore strongly recommended, that for higher flexibility implementations of this interface use an object implementing the Time interface to hold the current time and delegate most of the functionality to that object.

Hooks:
Define New Timer Type , Incorporate Timer
Since:
v2.0
Version:
2.0 11/06/1999
Author:
Stephan Gambke

Method Summary
 void addTimerListener(TimerListener tlListener)
          Adds a listener for TimerEvents fired by this timer.
 Object getInterval()
          Get the current interval for calls to goAhead().
 Object getTime()
          Get the current time.
 Comparable getTimeStamp()
          Create and return a fresh time stamp.
 void goAhead()
          Increases the current time by an interval.
 void removeTimerListener(TimerListener tlListener)
          Removes a listener for TimerEvents.
 void setInterval(Object oInterval)
          Set the interval to be used by goAhead().
 void setTime(Object oTime)
          Set the current time.
 

Method Detail

setTime

public void setTime(Object oTime)
             throws IllegalArgumentException
Set the current time.

This method should call the equivalent method of the Time object and fire a timeSet event.

Of course, IllegalArgumentExceptions thrown by the Time object must be forwarded to the calling method.

Override:
Always.
Parameters:
oTime - the time to be set
See Also:
TimerListener.onTimeSet(sale.events.TimerEvent)

getTime

public Object getTime()
Get the current time.

This method should call the equivalent method of the Time object.

Override:
Always.
Returns:
an Object representing the current time

setInterval

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

An IllegalArgumentException is not yet thrown because the new interval is only stored.

This method should fire an intervalSet event.

Override:
Always.
Parameters:
oInterval - the interval to be set
See Also:
TimerListener.onIntervalSet(sale.events.TimerEvent)

getInterval

public Object getInterval()
Get the current interval for calls to goAhead().
Override:
Always.
Returns:
an Object representing the interval

addTimerListener

public void addTimerListener(TimerListener tlListener)
Adds a listener for TimerEvents fired by this timer.
Override:
Always.
Parameters:
tlListener - the listener to be added
See Also:
TimerListener

removeTimerListener

public void removeTimerListener(TimerListener tlListener)
Removes a listener for TimerEvents.
Override:
Always.
Parameters:
tlListener - the listener to be removed
See Also:
TimerListener

goAhead

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

This method should call the equivalent method at the Time object passing the interval set by through setInterval(). If no interval has been set yet, the Time object's getDefaultInterval() method can be used to get a valid default.

Additionally, a goneAhead event should be fired.

This method forwards IllegalArgumentExceptions thrown by the Time object's goAhead() method to the calling method.

Override:
Always.
Throws:
IllegalArgumentException - if the interval does not meet the time object's class or format requirements
See Also:
TimerListener.onGoneAhead(sale.events.TimerEvent)

getTimeStamp

public Comparable getTimeStamp()
Create and return a fresh time stamp.

This method should call the Time object's getTimeStamp() method passing a long value representing the number of the time stamp in this time period.

Override:
Always.

SalesPoint Framework v3.0