pmlib
Class PMLEvent

java.lang.Object
  extended by pmlib.PMLEvent
All Implemented Interfaces:
java.lang.Comparable

public class PMLEvent
extends java.lang.Object
implements java.lang.Comparable

PMLEvent Class

The PMLEvent object allows an array of floating point values to be stored alongside a String identifier and frame number.

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
PMLEvent(java.lang.String t, int f, float[] v)
          Create a new object instance with the specified variables
 
Method Summary
 int compareTo(java.lang.Object obj)
          Implementation of the Comparable interface - objects are compared based on their frame numbers
 PMLEvent copy()
          Return a copy of this object
 int frame()
          Return the frame number
static PMLEvent fromString(java.lang.String s)
          Create and return an SeqEvent object from a string in the format 'frame tag var_0 var_1 ...
 boolean hasTag(java.lang.String t)
          Return true if the tag of this object matches that specified
 boolean hasVars(float[] v)
          Return true if the variables of this object match those specified
 void setFrame(int f)
          Set the frame number
 java.lang.String tag()
          Return the event tag string
 java.lang.String toString()
          Return the contents of the object as a string in the format 'frame tag var_0 var_1 ...
 float[] vars()
          Return the stored values as an array of floats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PMLEvent

public PMLEvent(java.lang.String t,
                int f,
                float[] v)
Create a new object instance with the specified variables

Parameters:
t - tag
f - frame
v - values
Method Detail

tag

public java.lang.String tag()
Return the event tag string

Returns:
the event tag string

vars

public float[] vars()
Return the stored values as an array of floats

Returns:
the stored values as an array of floats

setFrame

public void setFrame(int f)
Set the frame number

Parameters:
f - frame number

frame

public int frame()
Return the frame number

Returns:
the frame number

toString

public java.lang.String toString()
Return the contents of the object as a string in the format 'frame tag var_0 var_1 ... var_n'

Overrides:
toString in class java.lang.Object
Returns:
the contents of the object as a string

fromString

public static PMLEvent fromString(java.lang.String s)
Create and return an SeqEvent object from a string in the format 'frame tag var_0 var_1 ... var_n'

If the frame or variable values cannot be parsed into integer and float values respectively a null value will be returned.

Parameters:
s - string
Returns:
a PMLEvent object

compareTo

public int compareTo(java.lang.Object obj)
Implementation of the Comparable interface - objects are compared based on their frame numbers

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - object to compare with
Returns:
the result of the comparison

hasTag

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

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

hasVars

public boolean hasVars(float[] v)
Return true if the variables of this object match those specified

Parameters:
v - variables
Returns:
true if the variables of this object match those specified

copy

public PMLEvent copy()
Return a copy of this object

Returns:
a copy of this object