Package org.apache.batik.bridge
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WeakReference
A weak reference to the SVGAnimationEngine this AnimationTickRunnable is for.protected int
The number of consecutive exceptions that have been thrown.protected static final int
The maximum number of consecutive exceptions to allow before stopping the report of them.protected RunnableQueue
The RunnableQueue in which this is theRunnableQueue.IdleRunnable
.protected long
The sum of the times intimes
.protected Calendar
Calendar instance used for passing current time values to the animation timing system.protected int
The current index intotimes
.protected long[]
The past tick times.protected long
The number of milliseconds to wait until the next animation tick. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AnimationTickRunnable. -
Method Summary
Modifier and TypeMethodDescriptionprotected SVGAnimationEngine
Returns the SVGAnimationEngine this AnimationTickRunnable is for.long
Returns the system time that can be safely waited until before thisRunnable
is run again.void
resume()
Forces an animation update, if theRunnableQueue
is currently waiting.void
run()
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
. -
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 theRunnableQueue
is currently waiting. -
getWaitTime
public long getWaitTime()Returns the system time that can be safely waited until before thisRunnable
is run again.- Specified by:
getWaitTime
in interfaceRunnableQueue.IdleRunnable
- Returns:
- time to wait until,
0
if no waiting can be done, orLong.MAX_VALUE
if theRunnable
should not be run again at this time
-
run
public void run()Performs one tick of the animation. -
getAnimationEngine
Returns the SVGAnimationEngine this AnimationTickRunnable is for.
-