pmlib
Class PMLRoute

java.lang.Object
  extended by pmlib.PMLRoute

public class PMLRoute
extends java.lang.Object

PMLRoute Class

The PMLRoute object facilitates the dynamic creation and storage of multiple PMLFloat objects. Values sent to the object are routed to any stored objects with the correct tag preserving references. Only one instance of each tag is permitted per object.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.


Constructor Summary
PMLRoute()
          Create a new object instance with the default size
 
Method Summary
 boolean add(java.lang.String t)
          Add a tag to the object
 boolean add(java.lang.String t, float v)
          Add a tag to the object with the specified initial value
 boolean add(java.lang.String t, float v, int r)
          Add a tag to the object with the specified initial value and ramp time
 boolean add(java.lang.String t, int r)
          Add a tag to the object with the specified ramp time
 void clear()
          Remove all tags from the object
 PMLFloat get(java.lang.String t)
          Return the stored PMLFloat object with the specified tag
 boolean remove(java.lang.String t)
          Remove a tag from the object
 boolean route(PMLFloat f)
          Route data to any stored PMLFloat objects with the specified tag
 int route(PMLFloat[] f)
          Route an array of data to any stored PMLFloat objects with the specified tags
 boolean route(java.lang.String t, float v)
          Route data to any stored PMLFloat objects with the specified tag
 int size()
          Return the size of this object
 PMLFloat[] toArray()
          Return all stored PMLFloat objects as an array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PMLRoute

public PMLRoute()
Create a new object instance with the default size

Method Detail

add

public boolean add(java.lang.String t)
Add a tag to the object

The tag will only be added if no such tag is already stored

Parameters:
t - tag
Returns:
true if the tag was successfully added

add

public boolean add(java.lang.String t,
                   float v)
Add a tag to the object with the specified initial value

The tag will only be added if no such tag is already stored

Parameters:
t - tag
v - initial value
Returns:
true if the tag was successfully added

add

public boolean add(java.lang.String t,
                   int r)
Add a tag to the object with the specified ramp time

The tag will only be added if no such tag is already stored

Parameters:
t - tag
r - ramp time (ms)
Returns:
true if the tag was successfully added

add

public boolean add(java.lang.String t,
                   float v,
                   int r)
Add a tag to the object with the specified initial value and ramp time

The tag will only be added if no such tag is already stored

Parameters:
t - tag
v - initial value
r - ramp time (ms)
Returns:
true if the tag was successfully added

remove

public boolean remove(java.lang.String t)
Remove a tag from the object

Parameters:
t - tag
Returns:
true if the tag was successfully removed

clear

public void clear()
Remove all tags from the object


route

public int route(PMLFloat[] f)
Route an array of data to any stored PMLFloat objects with the specified tags

Parameters:
f - data array
Returns:
the number of modified objects

route

public boolean route(PMLFloat f)
Route data to any stored PMLFloat objects with the specified tag

Parameters:
f - data
Returns:
true if the specified tag exists

route

public boolean route(java.lang.String t,
                     float v)
Route data to any stored PMLFloat objects with the specified tag

Parameters:
t - tag
v - value
Returns:
true if the specified tag exists

get

public PMLFloat get(java.lang.String t)
Return the stored PMLFloat object with the specified tag

Returns null if no such object was found

Parameters:
t - tag
Returns:
the stored PMLFloat object with the specified tag

toArray

public PMLFloat[] toArray()
Return all stored PMLFloat objects as an array

Returns:
all stored PMLFloat objects as an array

size

public int size()
Return the size of this object

Returns:
the size of this object