org.robokind.api.animation.compiled
Class CompiledMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<Integer,CompiledPath>
org.robokind.api.animation.compiled.CompiledMap
- All Implemented Interfaces:
- Serializable, Cloneable, Map<Integer,CompiledPath>
public class CompiledMap
- extends HashMap<Integer,CompiledPath>
A HashMap of ServoIDs and corresponding CompiledPath.
All CompiledPaths must have the same stepLength.
All CompiledPaths are normalized to have the same start and end times;
The start and stop times are pulled from the CompiledPaths added.
- Author:
- Matthew Stevenson
- See Also:
- Serialized Form
Constructor Summary |
CompiledMap(long stepLen)
Creates an empty CompiledMap with the given stepLength. |
CompiledMap(long stepLen,
long start,
long end)
Creates an empty CompiledMap with the given stepLength, and time range. |
Method Summary |
Object |
clone()
|
long |
getEndTime()
Returns the time of the last position contained in the CompiledMap. |
long |
getStartTime()
Returns animation start offset time in milliseconds. |
CompiledPath |
put(Integer key,
CompiledPath value)
Same as HashMap.put() but does not allow null keys or values, and checks
the stepLength of the given path. |
void |
putAll(Map<? extends Integer,? extends CompiledPath> m)
Same as HashMap.put() but does not allow null keys or values, and checks
the stepLength of the given path. |
void |
setTimes(long start,
long end,
boolean normalizeTimes)
Adjusts all CompiledPaths to use the given times. |
CompiledMap
public CompiledMap(long stepLen)
- Creates an empty CompiledMap with the given stepLength.
- Parameters:
stepLen
- milliseconds between positions
CompiledMap
public CompiledMap(long stepLen,
long start,
long end)
- Creates an empty CompiledMap with the given stepLength, and time range.
- Parameters:
stepLen
- milliseconds between positionsstart
- start timeend
- end time
getStartTime
public long getStartTime()
- Returns animation start offset time in milliseconds.
This is the length of the expected pause before movement.
- Returns:
- animation start offset time in milliseconds
getEndTime
public long getEndTime()
- Returns the time of the last position contained in the CompiledMap.
- Returns:
- time of the last position contained in the CompiledMap
put
public CompiledPath put(Integer key,
CompiledPath value)
throws IllegalArgumentException
- Same as HashMap.put() but does not allow null keys or values, and checks
the stepLength of the given path. If the key exists, the paths are
combined with the current path taking precedent.
- Specified by:
put
in interface Map<Integer,CompiledPath>
- Overrides:
put
in class HashMap<Integer,CompiledPath>
- Parameters:
key
- logical servo idvalue
- CompiledPath for the given servo
- Returns:
- resulting CompiledPath for servo id
- Throws:
IllegalArgumentException
- if key or value is null or if the
stepLengths do not match
putAll
public void putAll(Map<? extends Integer,? extends CompiledPath> m)
throws IllegalArgumentException
- Same as HashMap.put() but does not allow null keys or values, and checks
the stepLength of the given path. If the key exists, the paths are
combined with the current path taking precedent.
- Specified by:
putAll
in interface Map<Integer,CompiledPath>
- Overrides:
putAll
in class HashMap<Integer,CompiledPath>
- Parameters:
m
- map containing servo id and CompiledPath pairs
- Throws:
IllegalArgumentException
- if null key or value is given or if the
stepLengths do not match
setTimes
public void setTimes(long start,
long end,
boolean normalizeTimes)
- Adjusts all CompiledPaths to use the given times.
- Parameters:
start
- new start timeend
- new end timenormalizeTimes
- if true, the start and end times are set to
multiples of the stepLength. If not normalized, some value < stepLength
can be added or removed
clone
public Object clone()
- Overrides:
clone
in class HashMap<Integer,CompiledPath>
Copyright © 2011-2013. All Rights Reserved.