org.robokind.api.common.playable
Interface Playable

All Known Implementing Classes:
AbstractPlayable

public interface Playable

An interface defining standard play controls: start, pause, resume, and stop.

Author:
Matthew Stevenson

Method Summary
 void addPlayableListener(PlayableListener listener)
          Adds a PlayableListener to be notified when the PlayState changes.
 boolean complete(long time)
          Stops the Playable, marking it complete.
 Long getElapsedPauseTime(long time)
          Returns the elapsed time between the last pause time and the given time.
 Long getElapsedPlayTime(long time)
          Returns the elapsed time between the start time and the given time.
 Long getPauseTime()
          Returns the time given when the Playable was last paused.
 PlayState getPlayState()
          Return the current PlayState of the Playable.
 Long getResumeTime()
          Returns the time given when the Playable was last resumed.
 Long getStartTime()
          Returns the time given when the Playable was started.
 Long getStopTime()
          Returns the time given when the Playable was last stopped.
 boolean pause(long time)
          Pauses the Playable in its current state.
 void removePlayableListener(PlayableListener listener)
          Removes a PlayableListener from being notified
 boolean resume(long time)
          Resumes a paused Playable.
 boolean start(long time)
          Starts the Playable from its initial state.
 boolean stop(long time)
          Stops a Playable, returning to the initial state.
 

Method Detail

addPlayableListener

void addPlayableListener(PlayableListener listener)
Adds a PlayableListener to be notified when the PlayState changes.

Parameters:
listener - PlayableListener to be added

removePlayableListener

void removePlayableListener(PlayableListener listener)
Removes a PlayableListener from being notified

Parameters:
listener - PlayableListener to remove

getPlayState

PlayState getPlayState()
Return the current PlayState of the Playable.

Returns:
the current PlayState of the Playable

start

boolean start(long time)
Starts the Playable from its initial state. If successful, the resulting PlayState is RUNNING.

Parameters:
time - when the Playable is started (used to synchronize actions) the time is usually the current system time UTC.
Returns:
true if successful

pause

boolean pause(long time)
Pauses the Playable in its current state. If successful, the resulting PlayState is PAUSED.

Parameters:
time - when the Playable is paused (used to synchronize actions)
Returns:
true if successful

resume

boolean resume(long time)
Resumes a paused Playable. If successful, the resulting PlayState is RUNNING.

Parameters:
time - when the Playable is resumed (used to synchronize actions)
Returns:
true if successful

stop

boolean stop(long time)
Stops a Playable, returning to the initial state. If successful, the resulting PlayState is STOPPED.

Parameters:
time - when the Playable is stopped (used to synchronize actions)
Returns:
true if successful

complete

boolean complete(long time)
Stops the Playable, marking it complete. If successful, the resulting PlayState is COMPLETED.

Parameters:
time - when the Playable is complete (used to synchronize actions)
Returns:
true if successful

getStartTime

Long getStartTime()
Returns the time given when the Playable was started. Returns null if the Playable has not been started.

Returns:
the time given when the Playable was started. Returns null if the Playable has not been started

getPauseTime

Long getPauseTime()
Returns the time given when the Playable was last paused. Returns null if the Playable has not been paused.

Returns:
the time given when the Playable was last paused. Returns null if the Playable has not been paused

getResumeTime

Long getResumeTime()
Returns the time given when the Playable was last resumed. Returns null if the Playable has not been resumed.

Returns:
the time given when the Playable was last resumed. Returns null if the Playable has not been resumed

getStopTime

Long getStopTime()
Returns the time given when the Playable was last stopped. Returns null if the Playable has not been stopped.

Returns:
the time given when the Playable was last stopped. Returns null if the Playable has not been stopped

getElapsedPlayTime

Long getElapsedPlayTime(long time)
Returns the elapsed time between the start time and the given time.

Parameters:
time - the time to check
Returns:
the elapsed time between the start time and the given time

getElapsedPauseTime

Long getElapsedPauseTime(long time)
Returns the elapsed time between the last pause time and the given time.

Parameters:
time - the time to check
Returns:
the elapsed time between the last pause time and the given time


Copyright © 2011-2013. All Rights Reserved.