org.epics.pvmanager.sim
Class SimFunction<T>

java.lang.Object
  extended by org.epics.pvmanager.sim.SimFunction<T>

public abstract class SimFunction<T>
extends java.lang.Object

Base class for all simulated signals. It provides the common mechanism for registering the update on a timer and a few other utilities.

Author:
carcassi

Constructor Summary
SimFunction(double secondsBeetwenSamples, java.lang.Class<T> classToken)
          Creates a new simulation function.
 
Method Summary
 void initialize(Collector collector, ValueCache<T> cache)
          Initialize timer task.
protected  VDouble newValue(double value, VDouble oldValue)
          Creating new value based on the metadata from the old value.
protected abstract  T nextValue()
          Calculates and returns the next value.
 void start(java.util.Timer timer)
          Starts notification by dispatching the prepared task on the timer.
 void stop()
          Stops the variable from further notifications.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimFunction

public SimFunction(double secondsBeetwenSamples,
                   java.lang.Class<T> classToken)
Creates a new simulation function.

Parameters:
secondsBeetwenSamples - seconds between each samples
Method Detail

nextValue

protected abstract T nextValue()
Calculates and returns the next value.

Returns:
the next value

initialize

public void initialize(Collector collector,
                       ValueCache<T> cache)
Initialize timer task. Must be called before start.

Parameters:
collector - collector notified of updates
cache - cache to put the new value in

start

public void start(java.util.Timer timer)
Starts notification by dispatching the prepared task on the timer.

Parameters:
timer - timer on which to execute the updates

stop

public void stop()
Stops the variable from further notifications.


newValue

protected VDouble newValue(double value,
                           VDouble oldValue)
Creating new value based on the metadata from the old value.

Parameters:
value - new numeric value
oldValue - old VDouble
Returns:
new VDouble


Copyright © 2010. All Rights Reserved.