pmlib
Class PMLFloat

java.lang.Object
  extended by pmlib.PMLFloat

public class PMLFloat
extends java.lang.Object

PMLFloat Class

The PMLFloat object allows the storage of a float value alongside a String identifier.

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
PMLFloat(java.lang.String t, float v)
          Create a new object instance with the specified tag and value with no value ramping
PMLFloat(java.lang.String t, float v, int r)
          Create a new object instance with the specified tag, value and ramp duration
 
Method Summary
 boolean booleanValue()
          Return the stored value as a boolean
 float floatValue()
          Return the stored value as a float
 PMLRange getRange()
          Return the output range for this object
 boolean hasChanged()
          Return true if the value of this object differs from the previous set value
 boolean hasTag(java.lang.String t)
          Return true if the object tag matches that specified
 int intValue()
          Return the stored value as a rounded integer
 void set(float v)
          Set the value of this object
 void set(int v)
          Set the value of this object
 void setRamp(int r)
          Set the ramp duration
 void setRange(PMLRange r)
          Define the output range of this object
 java.lang.String tag()
          Return the stored tag
 PMLEvent toEvent(int f)
          Return a PMLEvent object with the tag and value of this object instance and the frame number specified
 java.lang.String toString()
          Return the PMLFloat values as a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PMLFloat

public PMLFloat(java.lang.String t,
                float v)
Create a new object instance with the specified tag and value with no value ramping

Parameters:
t - tag
v - value

PMLFloat

public PMLFloat(java.lang.String t,
                float v,
                int r)
Create a new object instance with the specified tag, value and ramp duration

Parameters:
t - tag
v - value
r - ramp duration (ms)
Method Detail

booleanValue

public boolean booleanValue()
Return the stored value as a boolean

If a value range is specified, true will be returned if the stored value is greater than the midpoint of the range. If no value range is specified, true will be returned if the stored value is greater than zero.

Returns:
the stored value as a boolean

intValue

public int intValue()
Return the stored value as a rounded integer

Returns:
the stored value as a rounded integer

floatValue

public float floatValue()
Return the stored value as a float

Returns:
the stored value as a float

toEvent

public PMLEvent toEvent(int f)
Return a PMLEvent object with the tag and value of this object instance and the frame number specified

Parameters:
f - frame
Returns:
a PMLEvent object with the tag and value of this object instance

set

public void set(int v)
Set the value of this object

Parameters:
v - value

set

public void set(float v)
Set the value of this object

Parameters:
v - value

setRamp

public void setRamp(int r)
Set the ramp duration

Parameters:
r - ramp duration (ms)

setRange

public void setRange(PMLRange r)
Define the output range of this object

If the specified object is null, the output will not be limited.


getRange

public PMLRange getRange()
Return the output range for this object

If this object has no specified range, null will be returned.

Returns:
the output range for this object

tag

public java.lang.String tag()
Return the stored tag

Returns:
the stored tag

hasTag

public boolean hasTag(java.lang.String t)
Return true if the object tag matches that specified

Parameters:
t - tag
Returns:
true if the object tag matches that specified

hasChanged

public boolean hasChanged()
Return true if the value of this object differs from the previous set value

The value is deemed not to have changed if the difference between current and previous values is less than 1*10^-10.

Returns:
true if the value of this object differs from the previous set value

toString

public java.lang.String toString()
Return the PMLFloat values as a String

Overrides:
toString in class java.lang.Object
Returns:
the PMLFloat values as a String