player
Class AnimationScan

java.lang.Object
  extended by player.AnimationScan

public class AnimationScan
extends java.lang.Object

A state descriptor for a scan of an animation data-set, which may be represented by a full SiGMLAnimation data-set, or alternatively by a CASFrame sequence.


Constructor Summary
AnimationScan(SiGMLAnimation animdata)
          Constructs a scan for the given full animation data-set.
 
Method Summary
 void advanceFrame()
          Advances this scan to the next frame index, unless it is not initially in range.
 SiGMLAnimation animation()
          Returns this scan's underlying animation if any, otherwise null.
 boolean animationIsComplete()
          Indicates whether or not all the frames in the animation backing this scan have been generated yet.
 void checkForAnimationUpdate()
          If the animation is not yet complete and this scan is at a sign boundary then this method attempts to update the scan's signs-array.
 int f()
          Returns the current frame index.
 int fCount()
          Returns the current frame count.
 CASFrame frame()
          Returns the current frame if any, or null otherwise.
 boolean frameExists(int f)
          Indicates whether or not f is a valid frame index.
 boolean hasSigns()
          Indicates whether this scan is based on a full SiGMLAnimation object, or merely on a sequence of CASFrames.
 void reset()
          Resets the scan to the initial frame of the sequence.
 void resetToSign(int s)
          Resets this scan to the first frame of the given sign, and also sets the scan's limit to the sign's limit; assumes as a precondition that this scan has full animation data.
 void resetToSign(int s, boolean dolimit)
          Resets this scan to the first frame of the given sign, and also sets the scan's limit to the sign's limit if dolimit is true (currently, no caller passed false); assumes as a precondition that this scan has full animation data.
 int s()
          Returns the current sign index if any, otherwise -1.
 boolean scanIsAtLastFrame()
          Indicates whether or not the frame index has now reached the scan's last frame, that is, if the next frame is the current limit.
 boolean scanIsAtLastFrameInSign()
          Indicates whether or not the current frame is the last one in its sign, assuming both frame and sign exist.
 boolean scanIsAtLimit()
          Indicates whether or not the frame index has now reached the scan's current limit.
 boolean scanIsAtNewSign()
          Indicates whether or not the most recent frame setting also necessitates a change of sign setting.
 boolean scanIsOneSign()
          Indicates whether or not the current scan is for a single sign.
 int scanLimit()
          Returns this scan's limit frame index.
 int sCount()
          Returns the current sign count if any, otherwise -1.
 void setFrame(int f)
          Moves the scan to the given frame index, aligning the sign index with it.
 AnimatedSign sign()
          Returns the current sign if any, otherwise null.
 AnimatedSign sign(int s)
          Returns the sign with the given index, assuming this scan has signs, and the index is valid.
 boolean signExists(int s)
          Indicates whether or not s is a valid (animated) sign index, assuming as a precondition that this scanner has animation data.
 void waitForFrameIfNeeded()
          Waits if necessary until the current frame is available or until the animation is known to be complete, in which case the frame may not exist indicating that the scan is at its limit.
 void waitForFrames(int nf)
          Waits if necessary until the number of available animation frames is at least the given threshold value, or until the animation is known to be complete (possibly with fewer frames than the threshold value); assumes that the animation has signs.
 void waitForFullAnimation()
          Waits if necessary until the animation is known to be complete.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationScan

public AnimationScan(SiGMLAnimation animdata)
Constructs a scan for the given full animation data-set.

Method Detail

animationIsComplete

public boolean animationIsComplete()
Indicates whether or not all the frames in the animation backing this scan have been generated yet.


checkForAnimationUpdate

public void checkForAnimationUpdate()
If the animation is not yet complete and this scan is at a sign boundary then this method attempts to update the scan's signs-array.


waitForFrames

public void waitForFrames(int nf)
                   throws java.lang.InterruptedException
Waits if necessary until the number of available animation frames is at least the given threshold value, or until the animation is known to be complete (possibly with fewer frames than the threshold value); assumes that the animation has signs.

Throws:
java.lang.InterruptedException

waitForFrameIfNeeded

public void waitForFrameIfNeeded()
                          throws java.lang.InterruptedException
Waits if necessary until the current frame is available or until the animation is known to be complete, in which case the frame may not exist indicating that the scan is at its limit.

Throws:
java.lang.InterruptedException

waitForFullAnimation

public void waitForFullAnimation()
                          throws java.lang.InterruptedException
Waits if necessary until the animation is known to be complete.

Throws:
java.lang.InterruptedException

reset

public void reset()
Resets the scan to the initial frame of the sequence.


resetToSign

public void resetToSign(int s)
Resets this scan to the first frame of the given sign, and also sets the scan's limit to the sign's limit; assumes as a precondition that this scan has full animation data.


resetToSign

public void resetToSign(int s,
                        boolean dolimit)
Resets this scan to the first frame of the given sign, and also sets the scan's limit to the sign's limit if dolimit is true (currently, no caller passed false); assumes as a precondition that this scan has full animation data.


advanceFrame

public void advanceFrame()
Advances this scan to the next frame index, unless it is not initially in range.


setFrame

public void setFrame(int f)
Moves the scan to the given frame index, aligning the sign index with it.


hasSigns

public boolean hasSigns()
Indicates whether this scan is based on a full SiGMLAnimation object, or merely on a sequence of CASFrames.


scanIsOneSign

public boolean scanIsOneSign()
Indicates whether or not the current scan is for a single sign.


scanLimit

public int scanLimit()
Returns this scan's limit frame index.


scanIsAtLimit

public boolean scanIsAtLimit()
Indicates whether or not the frame index has now reached the scan's current limit.


scanIsAtLastFrame

public boolean scanIsAtLastFrame()
Indicates whether or not the frame index has now reached the scan's last frame, that is, if the next frame is the current limit.


scanIsAtLastFrameInSign

public boolean scanIsAtLastFrameInSign()
Indicates whether or not the current frame is the last one in its sign, assuming both frame and sign exist.


animation

public SiGMLAnimation animation()
Returns this scan's underlying animation if any, otherwise null.


sCount

public int sCount()
Returns the current sign count if any, otherwise -1.


fCount

public int fCount()
Returns the current frame count.


s

public int s()
Returns the current sign index if any, otherwise -1.


f

public int f()
Returns the current frame index.


frameExists

public boolean frameExists(int f)
Indicates whether or not f is a valid frame index.


signExists

public boolean signExists(int s)
Indicates whether or not s is a valid (animated) sign index, assuming as a precondition that this scanner has animation data.


scanIsAtNewSign

public boolean scanIsAtNewSign()
Indicates whether or not the most recent frame setting also necessitates a change of sign setting.


sign

public AnimatedSign sign(int s)
Returns the sign with the given index, assuming this scan has signs, and the index is valid.


sign

public AnimatedSign sign()
Returns the current sign if any, otherwise null.


frame

public CASFrame frame()
Returns the current frame if any, or null otherwise.