Class SVGAnimationEngine.AnimationTickRunnable
java.lang.Object
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.
- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WeakReferenceA weak reference to the SVGAnimationEngine this AnimationTickRunnable is for.protected intThe number of consecutive exceptions that have been thrown.protected static final intThe maximum number of consecutive exceptions to allow before stopping the report of them.private static final intThe number of past tick times to keep, for computing the average time per tick.protected RunnableQueueThe RunnableQueue in which this is theRunnableQueue.IdleRunnable.protected longThe sum of the times intimes.protected CalendarCalendar instance used for passing current time values to the animation timing system.protected intThe current index intotimes.protected long[]The past tick times.protected longThe number of milliseconds to wait until the next animation tick. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AnimationTickRunnable. -
Method Summary
Modifier and TypeMethodDescriptionprotected SVGAnimationEngineReturns the SVGAnimationEngine this AnimationTickRunnable is for.longReturns the system time that can be safely waited until before thisRunnableis run again.voidresume()Forces an animation update, if theRunnableQueueis currently waiting.voidrun()Performs one tick of the animation.
-
Field Details
-
time
Calendar instance used for passing current time values to the animation timing system. -
waitTime
protected long waitTimeThe number of milliseconds to wait until the next animation tick. This is returned bygetWaitTime(). -
q
The RunnableQueue in which this is theRunnableQueue.IdleRunnable. -
NUM_TIMES
private static final int NUM_TIMESThe number of past tick times to keep, for computing the average time per tick.- See Also:
-
times
protected long[] timesThe past tick times. -
sumTime
protected long sumTimeThe sum of the times intimes. -
timeIndex
protected int timeIndexThe current index intotimes. -
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_COUNTThe maximum number of consecutive exceptions to allow before stopping the report of them.- See Also:
-
exceptionCount
protected int exceptionCountThe 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 Details
-
AnimationTickRunnable
Creates a new AnimationTickRunnable.
-
-
Method Details
-
resume
public void resume()Forces an animation update, if theRunnableQueueis currently waiting. -
getWaitTime
public long getWaitTime()Returns the system time that can be safely waited until before thisRunnableis run again.- Specified by:
getWaitTimein interfaceRunnableQueue.IdleRunnable- Returns:
- time to wait until,
0if no waiting can be done, orLong.MAX_VALUEif theRunnableshould not be run again at this time
-
run
-
getAnimationEngine
Returns the SVGAnimationEngine this AnimationTickRunnable is for.
-