org.apache.batik.bridge

Class SVGAnimationEngine.AnimationTickRunnable

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

Idle runnable to tick the animation.
Field Summary
protected WeakReferenceengRef
A weak reference to the SVGAnimationEngine this AnimationTickRunnable is for.
protected intexceptionCount
The number of consecutive exceptions that have been thrown.
protected static intMAX_EXCEPTION_COUNT
The maximum number of consecutive exceptions to allow before stopping the report of them.
protected RunnableQueueq
The RunnableQueue in which this is the {@link RunnableQueue.IdleRunnable}.
protected longsumTime
The sum of the times in {@link #times}.
protected Calendartime
Calendar instance used for passing current time values to the animation timing system.
protected inttimeIndex
The current index into {@link #times}.
protected long[]times
The past tick times.
protected longwaitTime
The number of milliseconds to wait until the next animation tick.
Constructor Summary
AnimationTickRunnable(RunnableQueue q, SVGAnimationEngine eng)
Creates a new AnimationTickRunnable.
Method Summary
protected SVGAnimationEnginegetAnimationEngine()
Returns the SVGAnimationEngine this AnimationTickRunnable is for.
longgetWaitTime()
Returns the system time that can be safely waited until before this {@link Runnable} is run again.
voidresume()
Forces an animation update, if the {@link RunnableQueue} is currently waiting.
voidrun()
Performs one tick of the animation.

Field Detail

engRef

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

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.

MAX_EXCEPTION_COUNT

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

q

protected RunnableQueue q
The RunnableQueue in which this is the {@link RunnableQueue.IdleRunnable}.

sumTime

protected long sumTime
The sum of the times in {@link #times}.

time

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

timeIndex

protected int timeIndex
The current index into {@link #times}.

times

protected long[] times
The past tick times.

waitTime

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

Constructor Detail

AnimationTickRunnable

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

Method Detail

getAnimationEngine

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

getWaitTime

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

Returns: time to wait until, 0 if no waiting can be done, or {@link Long#MAX_VALUE} if the {@link Runnable} should not be run again at this time

resume

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

run

public void run()
Performs one tick of the animation.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.