org.multiply.processing
Class TimedEventGenerator

java.lang.Object
  extended by org.multiply.processing.TimedEventGenerator

public class TimedEventGenerator
extends Object


Field Summary
static String VERSION
           
 
Constructor Summary
TimedEventGenerator(PApplet parentApplet)
          Construct an enabled TimedEventGenerator with the default event handler name of onTimerEvent and the default interval of 500ms.
TimedEventGenerator(PApplet parentApplet, String timerEventName)
          Construct an enabled TimedEventGenerator with a custom event handler name and the default interval of 500ms.
TimedEventGenerator(PApplet parentApplet, String timerEventName, boolean isEnabled)
          Construct a TimedEventGenerator with a specific event handler name and specific enabled status.
TimedEventGenerator(PApplet parentApplet, String timerEventName, boolean isEnabled, int intervalMs)
          Construct a TimedEventGenerator with a specific event handler name, a specific enabled status and a specific interval.
 
Method Summary
 int getIntervalMs()
          Returns the currently configured number of milliseconds between timer events firing.
 boolean isEnabled()
           
 void setEnabled(boolean isEnabled)
          Turns the timer on or off according to the isEnabled argument.
 void setIntervalMs(int intervalMs)
          Set the number of milliseconds between timer events firing.
static String version()
          return the version of the library.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
See Also:
Constant Field Values
Constructor Detail

TimedEventGenerator

public TimedEventGenerator(PApplet parentApplet)
Construct an enabled TimedEventGenerator with the default event handler name of onTimerEvent and the default interval of 500ms.

Parameters:
parentApplet - the parent Applet that this library runs inside (this in your sketch).

TimedEventGenerator

public TimedEventGenerator(PApplet parentApplet,
                           String timerEventName)
Construct an enabled TimedEventGenerator with a custom event handler name and the default interval of 500ms.

Parameters:
parentApplet - the parent Applet that this library runs inside (this in your sketch).
timerEventName - the name of the method to invoke when the timer fires.

TimedEventGenerator

public TimedEventGenerator(PApplet parentApplet,
                           String timerEventName,
                           boolean isEnabled)
Construct a TimedEventGenerator with a specific event handler name and specific enabled status.

Parameters:
parentApplet - the parent Applet that this library runs inside (this in your sketch).
timerEventName - the name of the method to invoke when the timer fires.
isEnabled - determines if the TimedEventGenerator starts off active or not.

TimedEventGenerator

public TimedEventGenerator(PApplet parentApplet,
                           String timerEventName,
                           boolean isEnabled,
                           int intervalMs)
Construct a TimedEventGenerator with a specific event handler name, a specific enabled status and a specific interval.

Parameters:
parentApplet - the parent Applet that this library runs inside (this in your sketch).
timerEventName - the name of the method to invoke when the timer fires.
isEnabled - determines if the TimedEventGenerator starts off enabled or not.
Method Detail

isEnabled

public boolean isEnabled()
Returns:
if the timer events will fire in the parent sketch.

setEnabled

public void setEnabled(boolean isEnabled)
Turns the timer on or off according to the isEnabled argument.

Parameters:
isEnabled - whether or not the timer event will fire in the parent sketch.

getIntervalMs

public int getIntervalMs()
Returns the currently configured number of milliseconds between timer events firing.

Returns:
the interval time, in milliseconds.

setIntervalMs

public void setIntervalMs(int intervalMs)
Set the number of milliseconds between timer events firing. Changing this will cancel an enabled timer and immediately schedule a new one.

Parameters:
intervalMs - the interval time, in milliseconds.

version

public static String version()
return the version of the library.

Returns:
String


Processing library TimedEvents by Jason Gessner. 2012