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.

2009-10
Animation data in the form of raw frames is no longer supported, in line with the recent change to CAS 2.1, in which CAS is always structured as a sequence of signs, even if that means a single sign with gloss "unknown".


Constructor Summary
AnimationScan(SiGMLAnimation animdata, PlayerFlags flags)
          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 animationIsIncomplete()
          Indicates whether this scan is backed by an animation for which there are (or at least may be) yet further frames to be generated.
 int animFPS()
          Returns the frame-rate of the animation behind this scan.
 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 currently valid frame index.
 FrameIndexScanAccess getFrameIndexAccess()
          Returns a new FrameIndexScanAccess implementation bound to this scanner.
 boolean newSignExists()
          Given as a precondition that this scan is at a new sign, as revealed by scanIsAtNewSign(), this indicates whether or not the new sign is available yet.
 void resetForSequencePlay()
          Resets the scan to the start of the currently playing sign range, which is either the entire sequence or a single sign.
 int s()
          Returns the current sign index.
 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.
 void setFrame(int f)
          Moves the scan to the given frame index, aligning the sign index with it.
 void setSingleSignPlay(boolean single)
          Updates the single-sign play flag, and adjusts this scanner's limit settings accordingly.
 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.
 int signIndex(int f)
          Returns the sign index for the given frame in this animation, assuming the animation has signs and the frame index is valid.
 void tryWaitForFrames(int nf, java.lang.String tag)
          Like waitForFrames(int), but this method catches and reports any InterruptedException.
 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 than the specified number of frames).
 void waitForFramesIfNeeded(int nf)
          Waits if necessary until the given number of additional frames is available or until the animation is known to be complete, in which case some or all of the desired frames may not exist, indicating that the scan is at its limit.
 void waitForFramesWithTime(float tmillis)
          Waits if necessary until the frame whose timestamp is ahead of that of the current frame by the specified amount in milliseconds is available in this animation's frame set, or until the animation is known to be complete, possibly ending before the specified time; assumes that the amination has signs.
 void waitForFullAnimation()
          Waits if necessary until the animation is known to be complete.
 void waitForSigns(int ns)
          Waits if necessary until the number of available animation signs is at least the given threshold value, or until the animation is known to be complete, possibly with fewer than the specified number of signs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationScan

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

Method Detail

animFPS

public int animFPS()
Returns the frame-rate of the animation behind this scan.


setSingleSignPlay

public void setSingleSignPlay(boolean single)
Updates the single-sign play flag, and adjusts this scanner's limit settings accordingly.


animationIsIncomplete

public boolean animationIsIncomplete()
Indicates whether this scan is backed by an animation for which there are (or at least may be) yet further frames to be generated.


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.


waitForFramesWithTime

public void waitForFramesWithTime(float tmillis)
                           throws java.lang.InterruptedException
Waits if necessary until the frame whose timestamp is ahead of that of the current frame by the specified amount in milliseconds is available in this animation's frame set, or until the animation is known to be complete, possibly ending before the specified time; assumes that the amination has signs.

Throws:
java.lang.InterruptedException

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 than the specified number of frames).

Throws:
java.lang.InterruptedException

waitForSigns

public void waitForSigns(int ns)
                  throws java.lang.InterruptedException
Waits if necessary until the number of available animation signs is at least the given threshold value, or until the animation is known to be complete, possibly with fewer than the specified number of signs.

Throws:
java.lang.InterruptedException

tryWaitForFrames

public void tryWaitForFrames(int nf,
                             java.lang.String tag)
Like waitForFrames(int), but this method catches and reports any 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

waitForFramesIfNeeded

public void waitForFramesIfNeeded(int nf)
                           throws java.lang.InterruptedException
Waits if necessary until the given number of additional frames is available or until the animation is known to be complete, in which case some or all of the desired frames 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

resetForSequencePlay

public void resetForSequencePlay()
                          throws java.lang.InterruptedException
Resets the scan to the start of the currently playing sign range, which is either the entire sequence or a single sign.

Throws:
java.lang.InterruptedException

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.


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.


fCount

public int fCount()
Returns the current frame count.


s

public int s()
Returns the current sign index.


f

public int f()
Returns the current frame index.


frameExists

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


signExists

public boolean signExists(int s)
Indicates whether or not s is a valid (animated) sign index.


scanIsAtNewSign

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


newSignExists

public boolean newSignExists()
Given as a precondition that this scan is at a new sign, as revealed by scanIsAtNewSign(), this indicates whether or not the new sign is available yet.


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.


signIndex

public int signIndex(int f)
Returns the sign index for the given frame in this animation, assuming the animation has signs and the frame index is valid.


getFrameIndexAccess

public FrameIndexScanAccess getFrameIndexAccess()
Returns a new FrameIndexScanAccess implementation bound to this scanner.