public class ClockService extends BasicService implements IClockService, IPropertiesProvider
TYPE
EMPTY_SERVICES
Constructor and Description |
---|
ClockService(ClockCreationInfo cinfo,
IServiceProvider provider)
Create a new clock service.
|
ClockService(ClockCreationInfo cinfo,
IServiceProvider provider,
Map properties)
Create a new clock service.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(IChangeListener listener)
Add a change listener.
|
boolean |
advanceEvent()
Advance one event.
|
static IClock |
createClock(ClockCreationInfo cinfo,
IThreadPool tp)
Create a clock.
|
ITimer |
createTickTimer(ITimedObject to)
Create a new tick timer.
|
ITimer |
createTimer(long time,
ITimedObject to)
Create a new timer.
|
String |
getClockType()
Get the clock type.
|
long |
getDelta()
Get the clock delta.
|
double |
getDilation()
Get the clocks dilation.
|
ITimer |
getNextTimer()
Get the next timer.
|
IFuture<Properties> |
getProperties()
Write current state into properties.
|
long |
getStarttime()
Get the clocks start time.
|
String |
getState()
Get the clock state.
|
double |
getTick()
Get the current tick.
|
long |
getTime()
Get the current time.
|
ITimer[] |
getTimers()
Get all active timers.
|
void |
removeChangeListener(IChangeListener listener)
Remove a change listener.
|
void |
setClock(String type,
IThreadPool tp)
Set the clock.
|
void |
setDelta(long delta)
Set the clock delta.
|
void |
setDilation(double dilation)
Set the clocks dilation.
|
IFuture<Void> |
setProperties(Properties props)
Update from given properties.
|
IFuture |
shutdownService()
Shutdown the service.
|
void |
start()
Start the clock.
|
IFuture<Void> |
startService()
Start the service.
|
void |
stop()
Stop the clock.
|
createServiceIdentifier, createServiceIdentifier, equals, generateServiceName, getPropertyMap, getServiceIdentifier, isValid, setPropertyMap
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPropertyMap, getServiceIdentifier, isValid
public ClockService(ClockCreationInfo cinfo, IServiceProvider provider)
public ClockService(ClockCreationInfo cinfo, IServiceProvider provider, Map properties)
public long getTime()
getTime
in interface IClockService
public double getTick()
getTick
in interface IClockService
public long getStarttime()
getStarttime
in interface IClockService
public long getDelta()
getDelta
in interface IClockService
public void setDelta(long delta)
setDelta
in interface IClockService
delta
- The new clock delta.public String getState()
getState
in interface IClockService
public double getDilation()
getDilation
in interface IClockService
public void setDilation(double dilation)
setDilation
in interface IClockService
dilation
- The clocks dilation.
// Hack. Remove? only for continuouspublic String getClockType()
getClockType
in interface IClockService
public ITimer createTimer(long time, ITimedObject to)
System.currentTimeMillis()
.createTimer
in interface IClockService
timespan
- The relative timespan after which the timed object should be notified.to
- The timed object.public ITimer createTickTimer(ITimedObject to)
createTickTimer
in interface IClockService
to
- The timed object.public ITimer getNextTimer()
getNextTimer
in interface IClockService
public ITimer[] getTimers()
getTimers
in interface IClockService
public void addChangeListener(IChangeListener listener)
addChangeListener
in interface IClockService
listener
- The change listener.public void removeChangeListener(IChangeListener listener)
removeChangeListener
in interface IClockService
listener
- The change listener.public boolean advanceEvent()
advanceEvent
in interface IClockService
public void start()
start
in interface IClockService
public void stop()
stop
in interface IClockService
public IFuture<Void> startService()
startService
in interface IInternalService
startService
in class BasicService
public IFuture shutdownService()
shutdownService
in interface IInternalService
shutdownService
in class BasicService
listener
- The listener.public void setClock(String type, IThreadPool tp)
setClock
in interface IClockService
clock
- The new clock.public static IClock createClock(ClockCreationInfo cinfo, IThreadPool tp)
public IFuture<Void> setProperties(Properties props)
setProperties
in interface IPropertiesProvider
public IFuture<Properties> getProperties()
getProperties
in interface IPropertiesProvider
Copyright © 2012. All Rights Reserved.