org.robokind.api.animation
Class Channel

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

public class Channel
extends Object

Holds a list of MotionPaths, and can build a composite CompiledPath.

Author:
Matthew Stevenson

Constructor Summary
Channel(int id, String name)
          Create an empty Channel for given ServoParameters.
 
Method Summary
 void addPath(int i, MotionPath p)
          Adds a MotionPath to the list at the given index.
 void addPath(MotionPath p)
          Adds a MotionPath to the list.
 void addPaths(List<MotionPath> paths)
          Adds a List of MotionPaths to the Channel.
 Channel clone()
          Returns a deep copy of the Channel.
 CompiledPath compilePath(long start, long end, long stepLength)
          Creates a composite CompiledPath from all MotionPaths for given times.
 boolean equals(Object obj)
           
 CompiledPath getCompiledPath(long stepLength)
          Creates a composite CompiledPath from all MotionPaths.
 Integer getId()
          Returns the id of this Channel's Joint.
 List<Point2D> getInterpolatedPoints(long start, long end)
          Combines the interpolations from each motion path, omitting overlaps.
 MotionPath getMotionPath(int i)
          Returns the MotionPath for the given index.
 List<MotionPath> getMotionPaths()
          Returns the list of MotionPaths belonging to this Channel.
 String getName()
          Returns the name of this Channel's Joint.
 Long getStartTime()
          Returns the start time
 Long getStopTime()
          Returns the stop time
 int hashCode()
           
 MotionPath removeMotionPath(int i)
          Removes the MotionPath at the given index.
 int removeMotionPath(MotionPath mp)
          Removes the given MotionPath.
 void setId(int id)
          Sets the Channel's Id.
 void setName(String name)
          Sets the Channel's Name.
 void setStartTime(Long time)
          Sets the start time
 void setStopTime(Long time)
          Sets the stop time
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Channel

public Channel(int id,
               String name)
Create an empty Channel for given ServoParameters.

Parameters:
id - id for Channel
name - name for Channel
Method Detail

setId

public void setId(int id)
Sets the Channel's Id.

Parameters:
id - the new Channel id

getId

public Integer getId()
Returns the id of this Channel's Joint.

Returns:
the id of this Channel's Joint

setName

public void setName(String name)
Sets the Channel's Name.

Parameters:
name - the new Channel name

getName

public String getName()
Returns the name of this Channel's Joint.

Returns:
the name of this Channel's Joint

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

addPaths

public void addPaths(List<MotionPath> paths)
Adds a List of MotionPaths to the Channel.

Parameters:
paths - MotionPaths to add
Throws:
NullPointerException - if paths are null

addPath

public void addPath(MotionPath p)
Adds a MotionPath to the list.

Parameters:
p - MotionPath to add
Throws:
NullPointerException - if p is null

addPath

public void addPath(int i,
                    MotionPath p)
Adds a MotionPath to the list at the given index. If i < -1, the path is added at 0. If i > myPaths.size() the path is added to the end of the list.

Parameters:
i - the index to add at
p - MotionPath to add
Throws:
NullPointerException - if p is null

getMotionPaths

public List<MotionPath> getMotionPaths()
Returns the list of MotionPaths belonging to this Channel.

Returns:
list of MotionPaths belonging to this Channel

getMotionPath

public MotionPath getMotionPath(int i)
Returns the MotionPath for the given index.

Parameters:
i - index for the MotionPath to retrieve
Returns:
MotionPath for the given index, null if the index is out of bounds

removeMotionPath

public MotionPath removeMotionPath(int i)
Removes the MotionPath at the given index.

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

removeMotionPath

public int removeMotionPath(MotionPath mp)
Removes the given MotionPath.

Parameters:
mp - the MotionPath to remove
Returns:
the old index of the removed MotionPath, -1 if the MotionPath was not found

getCompiledPath

public CompiledPath getCompiledPath(long stepLength)
Creates a composite CompiledPath from all MotionPaths.

Parameters:
stepLength - milliseconds between path positions
Returns:
combined path from MotionPaths

compilePath

public CompiledPath compilePath(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

getInterpolatedPoints

public List<Point2D> getInterpolatedPoints(long start,
                                           long end)
Combines the interpolations from each motion path, omitting overlaps. Start and end constraints ignored only when (start == -1 && end == -1).

Parameters:
start - path start time
end - path end time
Returns:
combined interpolation from MotionPaths for given times

clone

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

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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2011-2013. All Rights Reserved.