org.xith3d.loop.opscheduler
Class Interval

java.lang.Object
  extended by org.xith3d.loop.opscheduler.Interval
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject
Direct Known Subclasses:
CameraFlightRecorder, ValueInterpolator

public class Interval
extends java.lang.Object
implements org.jagatoo.datatypes.NamableObject

You can register an instance of this class to ExtRenderLoop. Each time this interval is hit the appropriate method and listeners will be called.


Constructor Summary
Interval(long timeInterval)
          Creates a new Interval instance.
Interval(long timeInterval, java.lang.String name)
          Creates a new Interval instance.
 
Method Summary
 boolean check(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          Checks wheather this interval is hit.
 long getInterval()
           
 java.lang.String getName()
           
 boolean isAlive()
          If false, the interval will be removed from the ExtRenderLoop
 void kill()
          Marks this instance to be removed from the ExtRenderLoop.
protected  void onIntervalHit(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          This even is fired internally, when the Interval was hit.
protected  void onIntervalStarted(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          This even is fired internally, when the Interval is started.
 void revive()
          Revives the Interval to be reused.
 void setInterval(long timeInterval)
          Sets the time interval (in microseconds) for this instance.
 void setName(java.lang.String name)
          Sets this instance's name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interval

public Interval(long timeInterval,
                java.lang.String name)
Creates a new Interval instance.

Parameters:
timeInterval - the time interval for this instance (in microseconds)
name - this instance's name

Interval

public Interval(long timeInterval)
Creates a new Interval instance.

Parameters:
timeInterval - the time interval for this instance (in microseconds)
Method Detail

setInterval

public void setInterval(long timeInterval)
Sets the time interval (in microseconds) for this instance.

Parameters:
timeInterval - the new time interval (in microseconds)

getInterval

public long getInterval()
Returns:
the time interval (in microseconds) for this instance.

setName

public void setName(java.lang.String name)
Sets this instance's name.

Specified by:
setName in interface org.jagatoo.datatypes.NamableObject
Parameters:
name - the new name

getName

public java.lang.String getName()
Specified by:
getName in interface org.jagatoo.datatypes.NamedObject
Returns:
this instance's name.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this instance.

isAlive

public boolean isAlive()
If false, the interval will be removed from the ExtRenderLoop


kill

public void kill()
Marks this instance to be removed from the ExtRenderLoop.


revive

public void revive()
Revives the Interval to be reused.


onIntervalStarted

protected void onIntervalStarted(long gameTime,
                                 long frameTime,
                                 UpdatingThread.TimingMode timingMode)
This even is fired internally, when the Interval is started.

Parameters:
gameTime -
frameTime -
timingMode -

onIntervalHit

protected void onIntervalHit(long gameTime,
                             long frameTime,
                             UpdatingThread.TimingMode timingMode)
This even is fired internally, when the Interval was hit.

Parameters:
gameTime -
frameTime -
timingMode -

check

public boolean check(long gameTime,
                     long frameTime,
                     UpdatingThread.TimingMode timingMode)
Checks wheather this interval is hit.

Parameters:
gameTime - the current gameTime
frameTime - the time needed to render the last frame
timingMode -
Returns:
true, if this interval is hit