pmlib
Class PMLMatrix

java.lang.Object
  extended by pmlib.PMLMatrix

public class PMLMatrix
extends java.lang.Object

PMLMatrix Class

The PMLMatrix object allows multiple PMLInput objects to be attached. Values may be routed to each attached object using the relevant tag.

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
PMLMatrix()
          Create a new object instance with the default size
 
Method Summary
 void addInput(java.lang.String t)
          Add an input to the matrix with the specified tag and default limits (0, 1)
 void addInput(java.lang.String t, float min, float max)
          Add an input to the matrix with the specified tag and limits
 boolean addOutput(java.lang.String[] t_in, java.lang.String t_out)
          Add an output to multiple input channels with default limits (0, 1) and no value ramping
 boolean addOutput(java.lang.String[] t_in, java.lang.String t_out, float min, float max)
          Add an output to the multiple input channels with the specified limits and no value ramping
 boolean addOutput(java.lang.String[] t_in, java.lang.String t_out, float min, float max, int rmp)
          Add an an output to multiple input channels the specified limits and ramp duration
 boolean addOutput(java.lang.String t_in, java.lang.String t_out)
          Add an output to the matrix with default limits (0, 1) and no value ramping
 boolean addOutput(java.lang.String t_in, java.lang.String t_out, float min, float max)
          Add an output to the matrix with the specified limits and no value ramping
 boolean addOutput(java.lang.String t_in, java.lang.String t_out, float min, float max, int rmp)
          Add an an output to the matrix with the specified limits and ramp duration
 void clear()
          Clear the matrix
 PMLFloat get(java.lang.String t)
          Return a reference to the output PMLFloat object with the specified tag
 PMLFloat[] getAll()
          Return references to all output PMLFloat objects as an array
 boolean hasInput(java.lang.String t)
          Return true if an input with the specified tag is attached
 boolean hasOutput(java.lang.String t)
          Return true if an output with the specified tag is attached
 int removeInput(java.lang.String t)
          Remove any inputs with the specified tag
 int removeOutput(java.lang.String t)
          Remove any outputs with the specified tag
 void route(PMLFloat f)
          Route the specified PMLFloat to any applicable inputs
 void route(java.lang.String t, float v)
          Route the specified value to any applicable inputs
 void setEventHandler(PMLEventHandler h)
          Set the matrix event handler
 int size()
          Return the total input and output channels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PMLMatrix

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

Method Detail

addInput

public void addInput(java.lang.String t)
Add an input to the matrix with the specified tag and default limits (0, 1)

Parameters:
t - tag

addInput

public void addInput(java.lang.String t,
                     float min,
                     float max)
Add an input to the matrix with the specified tag and limits

Parameters:
t - tag
min - minimum
max - maximum

addOutput

public boolean addOutput(java.lang.String t_in,
                         java.lang.String t_out)
Add an output to the matrix with default limits (0, 1) and no value ramping

Parameters:
t_in - input channel to attach the output to
t_out - output channel tag
Returns:
true if the channel was successfully created

addOutput

public boolean addOutput(java.lang.String t_in,
                         java.lang.String t_out,
                         float min,
                         float max)
Add an output to the matrix with the specified limits and no value ramping

Parameters:
t_in - input channel to attach the output to
t_out - output channel tag
min - minimum
max - maximum
Returns:
true if the channel was successfully created

addOutput

public boolean addOutput(java.lang.String t_in,
                         java.lang.String t_out,
                         float min,
                         float max,
                         int rmp)
Add an an output to the matrix with the specified limits and ramp duration

Parameters:
t_in - input channel to attach the output to
t_out - output channel tag
min - minimum
max - maximum
rmp - ramp duration (ms)
Returns:
true if the channel was successfully created

addOutput

public boolean addOutput(java.lang.String[] t_in,
                         java.lang.String t_out)
Add an output to multiple input channels with default limits (0, 1) and no value ramping

Parameters:
t_in - input channels to attach the output to
t_out - output channel tag
Returns:
true if the channel was successfully created

addOutput

public boolean addOutput(java.lang.String[] t_in,
                         java.lang.String t_out,
                         float min,
                         float max)
Add an output to the multiple input channels with the specified limits and no value ramping

Parameters:
t_in - input channels to attach the output to
t_out - output channel tag
min - minimum
max - maximum
Returns:
true if the channel was successfully created

addOutput

public boolean addOutput(java.lang.String[] t_in,
                         java.lang.String t_out,
                         float min,
                         float max,
                         int rmp)
Add an an output to multiple input channels the specified limits and ramp duration

Parameters:
t_in - input channels to attach the output to
t_out - output channel tag
min - minimum
max - maximum
rmp - ramp duration (ms)
Returns:
true if the channel was successfully created

removeInput

public int removeInput(java.lang.String t)
Remove any inputs with the specified tag

Parameters:
t - tag
Returns:
total input channels removed

removeOutput

public int removeOutput(java.lang.String t)
Remove any outputs with the specified tag

Parameters:
t - tag
Returns:
total output channels removed

get

public PMLFloat get(java.lang.String t)
Return a reference to the output PMLFloat object with the specified tag

Parameters:
t - tag
Returns:
a reference to the output PMLFloat object with the specified tag

getAll

public PMLFloat[] getAll()
Return references to all output PMLFloat objects as an array

Returns:
references to all output PMLFloat objects as an array

clear

public void clear()
Clear the matrix


size

public int size()
Return the total input and output channels

Returns:
the total input and output channels

hasInput

public boolean hasInput(java.lang.String t)
Return true if an input with the specified tag is attached

Parameters:
t - tag
Returns:
true if an input with the specified tag is attached

hasOutput

public boolean hasOutput(java.lang.String t)
Return true if an output with the specified tag is attached

Parameters:
t - tag
Returns:
true if an output with the specified tag is attached

route

public void route(PMLFloat f)
Route the specified PMLFloat to any applicable inputs

If a valid input channel exists the mapped value will be routed to the relevant output, a reference to which may be obtained using the get() method. If an event handler is specified, the mapped value will also be routed to any specified object methods.

Parameters:
f - PMLFloat

route

public void route(java.lang.String t,
                  float v)
Route the specified value to any applicable inputs

If a valid input channel exists the mapped value will be routed to the relevant output, a reference to which may be obtained using the get() method. If an event handler is specified, the mapped value will also be routed to any specified object methods.

Parameters:
t - tag
v - value

setEventHandler

public void setEventHandler(PMLEventHandler h)
Set the matrix event handler

If the event handler is not null, matrix values will be routed to valid object methods specified within the event handler upon calling route().

Parameters:
h - event handler