org.xith3d.loop.opscheduler.impl
Class OperationSchedulerQueue

java.lang.Object
  extended by org.xith3d.loop.UpdatingThread
      extended by org.xith3d.loop.opscheduler.impl.OperationSchedulerQueue
All Implemented Interfaces:
java.lang.Runnable, GameTimeHost, Animator, OperationScheduler, Updatable, Updater

public class OperationSchedulerQueue
extends UpdatingThread
implements OperationScheduler

This is a queue, that takes instances of OperationScheduler. The Update


Nested Class Summary
 
Nested classes/interfaces inherited from class org.xith3d.loop.UpdatingThread
UpdatingThread.TimingMode
 
Field Summary
 
Fields inherited from class org.xith3d.loop.UpdatingThread
PAUSE_NONE, PAUSE_TOTAL
 
Constructor Summary
OperationSchedulerQueue()
           
OperationSchedulerQueue(GameTimeHost gameTimeHost)
           
OperationSchedulerQueue(long minItTime)
           
OperationSchedulerQueue(long minItTime, GameTimeHost gameTimeHost)
           
 
Method Summary
 void addAnimatableObject(Animatable anumObj)
          Adds an animatable object to the set.
 void addAnimatableObject(Animatable animObj, boolean startAnimation)
          Adds an animatable object to the set.
 void addAnimatableObject(Animatable animObj, long gameTime, UpdatingThread.TimingMode timingMode)
           
 void addInterval(Interval interval)
          Adds a new Interval to the scheduler, which will be checked each iteration.
 void addIntervalListener(IntervalListener l)
          Registers a new IntervalListner to this OperationScheduler.
 void addOperationScheduler(OperationScheduler opScheder)
          Adds a new OperationScheduler to the queue.
 void addOperationScheduler(OperationScheduler opScheder, int index)
          Adds a new OperationScheduler to the queue.
 void addUpdatable(Updatable updatable)
          Adds a new Updatable instance to the list, that is worked each frame.
 OperationScheduler getDefaultOperationScheduler()
           
 void removeAllIntervals()
          Removes all Intervals from the scheduler.
 void removeAnimatableObject(Animatable animObj)
          Removes an animatable object from the set.
 IntervalListener removeIntervalListener(IntervalListener l)
          Unregisters an IntervalListner from this OperationScheduler.
 void removeOperationScheduler(int index)
          Removes an OperationScheduler from the queue.
 void removeOperationScheduler(OperationScheduler opScheder)
          Removes an OperationScheduler from the queue.
 void removeUpdatable(Updatable updatable)
          Removes an Updatable instance from the list, that is worked each frame.
 void scheduleOperation(ScheduledOperation schedOp)
          Adds a ScheduledOperation to the queue.
 void setDefaultOperationScheduler(OperationScheduler defaultOpScheder)
          Sets the default OperationScheduler, that takes the calls to scheduleOperation(), etc. of this OperationSchedulerQueue.
 void unscheduleOperation(ScheduledOperation schedOp)
          Removes a ScheduledOperation from the queue.
 void update()
          Checks the list of operations and intervals and calls necessary methods if the time is right.
 void update(long gameTime)
          Checks the list of operations and intervals and calls necessary methods if the time is right.
 void update(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          Updates this Updatable object.
 
Methods inherited from class org.xith3d.loop.UpdatingThread
begin, end, getFPSLimiter, getGameMicroTime, getGameMilliTime, getGameNanoTime, getGameTime, getIterationsCount, getLastFrameTime, getLastNanoFrameTime, getMinIterationTime, getPauseMode, getThread, getTimer, getTimingMode, isRunning, isStopping, loop, nextIteration, run, setFPSLimiter, setMinIterationTime, setPauseMode, setTimer, setTimingMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSchedulerQueue

public OperationSchedulerQueue(long minItTime,
                               GameTimeHost gameTimeHost)

OperationSchedulerQueue

public OperationSchedulerQueue(long minItTime)

OperationSchedulerQueue

public OperationSchedulerQueue(GameTimeHost gameTimeHost)

OperationSchedulerQueue

public OperationSchedulerQueue()
Method Detail

addOperationScheduler

public void addOperationScheduler(OperationScheduler opScheder,
                                  int index)
Adds a new OperationScheduler to the queue.

Parameters:
opScheder -
index - the index, at which the OperationScheduler will be added

addOperationScheduler

public void addOperationScheduler(OperationScheduler opScheder)
Adds a new OperationScheduler to the queue.

Parameters:
opScheder -

removeOperationScheduler

public void removeOperationScheduler(int index)
Removes an OperationScheduler from the queue.

Parameters:
index -

removeOperationScheduler

public void removeOperationScheduler(OperationScheduler opScheder)
Removes an OperationScheduler from the queue.

Parameters:
opScheder -

setDefaultOperationScheduler

public void setDefaultOperationScheduler(OperationScheduler defaultOpScheder)
Sets the default OperationScheduler, that takes the calls to scheduleOperation(), etc. of this OperationSchedulerQueue.

Parameters:
defaultOpScheder -

getDefaultOperationScheduler

public OperationScheduler getDefaultOperationScheduler()
Returns:
the default OperationScheduler, that takes the calls to scheduleOperation(), etc. of this OperationSchedulerQueue.

scheduleOperation

public void scheduleOperation(ScheduledOperation schedOp)
Adds a ScheduledOperation to the queue. The loop works off the queue each iteration.

Specified by:
scheduleOperation in interface OperationScheduler
Parameters:
schedOp - the Operation to schedule

unscheduleOperation

public void unscheduleOperation(ScheduledOperation schedOp)
Removes a ScheduledOperation from the queue.

Specified by:
unscheduleOperation in interface OperationScheduler
Parameters:
schedOp - the Operation to unschedule

addInterval

public void addInterval(Interval interval)
Adds a new Interval to the scheduler, which will be checked each iteration. When the check() method returns true, all IntervalListeners are notified. This method immediately invokes the revive() method of the given Interval.

Specified by:
addInterval in interface OperationScheduler
Parameters:
interval - the new Interval

removeAllIntervals

public void removeAllIntervals()
Removes all Intervals from the scheduler.

Specified by:
removeAllIntervals in interface OperationScheduler

addIntervalListener

public void addIntervalListener(IntervalListener l)
Registers a new IntervalListner to this OperationScheduler.

Specified by:
addIntervalListener in interface OperationScheduler
Parameters:
l - the new IntervalListener

removeIntervalListener

public IntervalListener removeIntervalListener(IntervalListener l)
Unregisters an IntervalListner from this OperationScheduler.

Specified by:
removeIntervalListener in interface OperationScheduler
Parameters:
l - the IntervalListener to remove

addAnimatableObject

public void addAnimatableObject(Animatable animObj,
                                long gameTime,
                                UpdatingThread.TimingMode timingMode)

addAnimatableObject

public void addAnimatableObject(Animatable animObj,
                                boolean startAnimation)
Adds an animatable object to the set. And starts rotation if wanted. each rendering-loop-iteration the animate()-method is called.

Specified by:
addAnimatableObject in interface Animator
Parameters:
animObj - the object to animate
startAnimation - if true the startAnimation() method is executed immediately

addAnimatableObject

public void addAnimatableObject(Animatable anumObj)
Adds an animatable object to the set. each rendering-loop-iteration the animate()-method is called.

Specified by:
addAnimatableObject in interface Animator
Parameters:
anumObj - the object to animate

removeAnimatableObject

public void removeAnimatableObject(Animatable animObj)
Removes an animatable object from the set.

Specified by:
removeAnimatableObject in interface Animator
Parameters:
animObj - the object to remove

addUpdatable

public void addUpdatable(Updatable updatable)
Adds a new Updatable instance to the list, that is worked each frame. This is like adding a ScheduledOperation, that is infinitely alive and persistent.

Specified by:
addUpdatable in interface Updater

removeUpdatable

public void removeUpdatable(Updatable updatable)
Removes an Updatable instance from the list, that is worked each frame.

Specified by:
removeUpdatable in interface Updater

update

public void update(long gameTime,
                   long frameTime,
                   UpdatingThread.TimingMode timingMode)
Updates this Updatable object.

Specified by:
update in interface Animator
Specified by:
update in interface OperationScheduler
Specified by:
update in interface Updatable
Specified by:
update in class UpdatingThread
Parameters:
gameTime - the gameTime in Milliseconds
frameTime - the frameTime in Milliseconds (needed time for the last frame)
timingMode - the TimingMode to use for frameTime.

update

public void update(long gameTime)
Checks the list of operations and intervals and calls necessary methods if the time is right.

Parameters:
gameTime - the current game time

update

public void update()
Checks the list of operations and intervals and calls necessary methods if the time is right.