パッケージ simulation.event
クラス SimpleTimerEvent
java.lang.Object
simulation.event.SimpleTimerEvent
- すべての実装されたインタフェース:
TimerEvent
Convenience base class for recurring
TimerEvent implementations with a fixed interval.
Subclasses only need to implement onTick(simulation.CombatSimulator) and optionally call finish() to
stop the event early. The next tick time is automatically advanced by interval
after each tick unless the event is already finished.
Example use: a periodic buff refresh that fires every 2.0 seconds until
finish() is called.
-
フィールドの概要
フィールド修飾子とタイプフィールド説明protected booleanWhether the event has been marked complete viafinish().protected doubleThe fixed interval in seconds between successive ticks.protected doubleThe simulation time at which the next tick will fire. -
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明voidfinish()Marks this event as complete.doubleReturns the simulation time at which this event's nextTimerEvent.tick(simulation.CombatSimulator)should fire.booleanisFinished(double currentTime) Returnstrueoncefinish()has been called.abstract voidonTick(CombatSimulator sim) Subclass hook called on every tick.voidtick(CombatSimulator sim) Delegates toonTick(simulation.CombatSimulator)and then advancesnextTickTimebyintervalif the event has not been finished.
-
フィールド詳細
-
nextTickTime
protected double nextTickTimeThe simulation time at which the next tick will fire. -
interval
protected double intervalThe fixed interval in seconds between successive ticks. -
finished
protected boolean finishedWhether the event has been marked complete viafinish().
-
-
コンストラクタの詳細
-
SimpleTimerEvent
public SimpleTimerEvent(double startTime, double interval) Constructs a new recurring event.- パラメータ:
startTime- the simulation time of the first tickinterval- the interval in seconds between consecutive ticks
-
-
メソッドの詳細
-
getNextTickTime
public double getNextTickTime()Returns the simulation time at which this event's nextTimerEvent.tick(simulation.CombatSimulator)should fire.- 定義:
getNextTickTimeインタフェース内TimerEvent- 戻り値:
- next tick time in seconds
-
isFinished
public boolean isFinished(double currentTime) Returnstrueoncefinish()has been called.- 定義:
isFinishedインタフェース内TimerEvent- パラメータ:
currentTime- current simulation time (unused by this implementation)- 戻り値:
trueif the event is finished
-
finish
public void finish()Marks this event as complete. After this call,isFinished(double)will returntrueand the event will not be re-queued after its next tick. -
tick
Delegates toonTick(simulation.CombatSimulator)and then advancesnextTickTimebyintervalif the event has not been finished.- 定義:
tickインタフェース内TimerEvent- パラメータ:
sim- theCombatSimulatormanaging this event
-
onTick
Subclass hook called on every tick. Implement this to define the event's periodic behavior.- パラメータ:
sim- theCombatSimulatormanaging this event
-