org.apache.batik.bridge
Class SVGAnimationEngine.AnimationTickRunnable

java.lang.Object
  extended by org.apache.batik.bridge.SVGAnimationEngine.AnimationTickRunnable
All Implemented Interfaces:
Runnable, RunnableQueue.IdleRunnable
Direct Known Subclasses:
SVGAnimationEngine.DebugAnimationTickRunnable
Enclosing class:
SVGAnimationEngine

protected static class SVGAnimationEngine.AnimationTickRunnable
extends Object
implements RunnableQueue.IdleRunnable

Idle runnable to tick the animation.


Field Summary
protected  WeakReference engRef
          A weak reference to the SVGAnimationEngine this AnimationTickRunnable is for.
protected  int exceptionCount
          The number of consecutive exceptions that have been thrown.
protected static int MAX_EXCEPTION_COUNT
          The maximum number of consecutive exceptions to allow before stopping the report of them.
protected  RunnableQueue q
          The RunnableQueue in which this is the RunnableQueue.IdleRunnable.
protected  long sumTime
          The sum of the times in times.
protected  Calendar time
          Calendar instance used for passing current time values to the animation timing system.
protected  int timeIndex
          The current index into times.
protected  long[] times
          The past tick times.
protected  long waitTime
          The number of milliseconds to wait until the next animation tick.
 
Constructor Summary
SVGAnimationEngine.AnimationTickRunnable(RunnableQueue q, SVGAnimationEngine eng)
          Creates a new AnimationTickRunnable.
 
Method Summary
protected  SVGAnimationEngine getAnimationEngine()
          Returns the SVGAnimationEngine this AnimationTickRunnable is for.
 long getWaitTime()
          Returns the system time that can be safely waited until before this Runnable is run again.
 void resume()
          Forces an animation update, if the RunnableQueue is currently waiting.
 void run()
          Performs one tick of the animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

time

protected Calendar time
Calendar instance used for passing current time values to the animation timing system.


waitTime

protected long waitTime
The number of milliseconds to wait until the next animation tick. This is returned by getWaitTime().


q

protected RunnableQueue q
The RunnableQueue in which this is the RunnableQueue.IdleRunnable.


times

protected long[] times
The past tick times.


sumTime

protected long sumTime
The sum of the times in times.


timeIndex

protected int timeIndex
The current index into times.


engRef

protected WeakReference engRef
A weak reference to the SVGAnimationEngine this AnimationTickRunnable is for. We make this a WeakReference so that a ticking animation engine does not prevent from being GCed.


MAX_EXCEPTION_COUNT

protected static final int MAX_EXCEPTION_COUNT
The maximum number of consecutive exceptions to allow before stopping the report of them.

See Also:
Constant Field Values

exceptionCount

protected int exceptionCount
The number of consecutive exceptions that have been thrown. This is used to detect when exceptions are occurring every tick, and to stop reporting them when this happens.

Constructor Detail

SVGAnimationEngine.AnimationTickRunnable

public SVGAnimationEngine.AnimationTickRunnable(RunnableQueue q,
                                                SVGAnimationEngine eng)
Creates a new AnimationTickRunnable.

Method Detail

resume

public void resume()
Forces an animation update, if the RunnableQueue is currently waiting.


getWaitTime

public long getWaitTime()
Returns the system time that can be safely waited until before this Runnable is run again.

Specified by:
getWaitTime in interface RunnableQueue.IdleRunnable
Returns:
time to wait until, 0 if no waiting can be done, or Long.MAX_VALUE if the Runnable should not be run again at this time

run

public void run()
Performs one tick of the animation.

Specified by:
run in interface Runnable

getAnimationEngine

protected SVGAnimationEngine getAnimationEngine()
Returns the SVGAnimationEngine this AnimationTickRunnable is for.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.