org.robokind.api.animation
Class Animation

java.lang.Object
  extended by org.robokind.api.animation.Animation

public class Animation
extends Object

An Animation holds a map of servo IDs and Channel. This also stores the JointParameters corresponding to each Channel.

Author:
Matthew Stevenson

Constructor Summary
Animation()
          Creates an empty Animation.
Animation(org.robokind.api.common.config.VersionProperty version)
          Creates an Animation with the given VersionProperty.
 
Method Summary
 void addChannel(Channel channel)
          Adds a given Channel for the given servo parameters.
 void addChannels(List<Channel> channels)
          Adds a list of Channels.
 Animation clone()
          Returns a deep copy of the Animation.
 CompiledMap compileMap(long start, long end, long stepLength)
          Creates a composite CompiledPath from all MotionPaths for given times.
 boolean containsLogicalId(int id)
          Returns true if there exists a channel for the given id.
 Channel getChannel(int id)
          Returns the Channel for id, ordered by when the Channels were added.
 Channel getChannelByLogicalId(int id)
          Returns the Channel for the given id.
 List<Channel> getChannels()
          Returns a set of entries of servo ids and Channels
 CompiledMap getCompiledMap(long stepLength)
          Creates a CompiledMap from contained Channels' CompiledPaths.
 Set<Map.Entry<Integer,Channel>> getEntrySet()
          Returns a set of entries of servo ids and Channels
 Long getStartTime()
          Returns the start time
 Long getStopTime()
          Returns the stop time
 org.robokind.api.common.config.VersionProperty getVersion()
          Returns The Animation's Version.
 void insertChannel(int i, Channel channel)
          Adds a given Channel for the given servo parameters, and orders it by the given index.
 Channel removeChannelByListOrder(int i)
          Removes the ith Channel, ordered by when the channels were added.
 Channel removeChannelByLogicalId(int logicalId)
          Removes the Channel with the given logical id.
 void setStartTime(Long time)
          Sets the start time
 void setStopTime(Long time)
          Sets the stop time
 void setVersion(String name, String versionNumber)
          Set the Animation's Version with the given name and version number.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Animation

public Animation()
Creates an empty Animation.


Animation

public Animation(org.robokind.api.common.config.VersionProperty version)
Creates an Animation with the given VersionProperty.

Parameters:
version - the Animation's Version
Method Detail

getVersion

public org.robokind.api.common.config.VersionProperty getVersion()
Returns The Animation's Version.

Returns:
the Animation's Version

setVersion

public void setVersion(String name,
                       String versionNumber)
Set the Animation's Version with the given name and version number.

Parameters:
name - the Animations new name
versionNumber - the Animations new version number

addChannel

public void addChannel(Channel channel)
                throws IllegalArgumentException
Adds a given Channel for the given servo parameters.

Parameters:
channel - Channel to add
Throws:
IllegalArgumentException - if servo id has already been added
NullPointerException - if channel is null

addChannels

public void addChannels(List<Channel> channels)
                 throws NullPointerException
Adds a list of Channels.

Parameters:
channels - Channels to add
Throws:
NullPointerException - if channels is null

setStartTime

public void setStartTime(Long time)
Sets the start time

Parameters:
time - start time

getStartTime

public Long getStartTime()
Returns the start time

Returns:
start time

setStopTime

public void setStopTime(Long time)
Sets the stop time

Parameters:
time - stop time

getStopTime

public Long getStopTime()
Returns the stop time

Returns:
stop time

insertChannel

public void insertChannel(int i,
                          Channel channel)
                   throws IllegalArgumentException
Adds a given Channel for the given servo parameters, and orders it by the given index.

Parameters:
channel - Channel to add
i - the index to insert the channel
Throws:
IllegalArgumentException - if servo id has already been added
NullPointerException - if channel is null

containsLogicalId

public boolean containsLogicalId(int id)
Returns true if there exists a channel for the given id.

Parameters:
id - servo id
Returns:
true if there exists a channel for the given id.

getChannel

public Channel getChannel(int id)
Returns the Channel for id, ordered by when the Channels were added.

Parameters:
id - for Channel
Returns:
Channel for given id

getChannelByLogicalId

public Channel getChannelByLogicalId(int id)
Returns the Channel for the given id.

Parameters:
id - Servo id for Channel
Returns:
Channel for given id, null if none exists

getEntrySet

public Set<Map.Entry<Integer,Channel>> getEntrySet()
Returns a set of entries of servo ids and Channels

Returns:
a set of entries of servo ids and Channels

getChannels

public List<Channel> getChannels()
Returns a set of entries of servo ids and Channels

Returns:
a set of entries of servo ids and Channels

removeChannelByListOrder

public Channel removeChannelByListOrder(int i)
Removes the ith Channel, ordered by when the channels were added.

Parameters:
i - the index of the channel to remove
Returns:
the removed Channel, null if i is out of bounds

removeChannelByLogicalId

public Channel removeChannelByLogicalId(int logicalId)
Removes the Channel with the given logical id.

Parameters:
logicalId - the logicalId of the Channel to remove
Returns:
the removed Channel, null if the logicalId is not found.

getCompiledMap

public CompiledMap getCompiledMap(long stepLength)
Creates a CompiledMap from contained Channels' CompiledPaths.

Parameters:
stepLength - milliseconds between positions
Returns:
CompiledMap from contained Channels' CompiledPaths

compileMap

public CompiledMap compileMap(long start,
                              long end,
                              long stepLength)
Creates a composite CompiledPath from all MotionPaths for given times. Start and end constraints ignored only when (start == -1 && end == -1).

Parameters:
start - path start time
end - path end time
stepLength - milliseconds between positions
Returns:
combined path from MotionPaths for given times

clone

public Animation clone()
Returns a deep copy of the Animation.

Overrides:
clone in class Object
Returns:
a deep copy of the Animation.


Copyright © 2011. All Rights Reserved.