stella.util
Class SchmidtTrigger

java.lang.Object
  extended by stella.util.SchmidtTrigger
All Implemented Interfaces:
Toggling

public class SchmidtTrigger
extends Object
implements Toggling

A Schmidt trigger. The Schmidt trigger needs two values, the on and off value. The history of the toggle state is taken into account in a very basic way: If the current toggle state is true, the new value added needs to fall below the off value to change the toggle state to false. On the other side, if the toggle state is at false, the new value added must be at least above the on value to toggle.


Field Summary
private  boolean current
          The current state of the toggle trigger.
private  double off
          The value that must be undercut to turn the toggle from true to false.
private  double on
          The value that must be exceeded to turn the toggle from false to true.
 
Constructor Summary
protected SchmidtTrigger()
          Common constructor.
  SchmidtTrigger(double offtrig, double ontrig)
          Constructs a new Schmidt trigger.
  SchmidtTrigger(String parameter)
          Constructs a new Schmidt trigger.
 
Method Summary
 boolean addHit(double val)
          Return true, if the argument value is above the appropriate trigger.
protected  void setTriggers(double offtrig, double ontrig)
          Sets the two trigger values.
 String toString()
          Returns the two toggle edges as a description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

current

private boolean current
The current state of the toggle trigger.


on

private double on
The value that must be exceeded to turn the toggle from false to true.


off

private double off
The value that must be undercut to turn the toggle from true to false.

Constructor Detail

SchmidtTrigger

protected SchmidtTrigger()
Common constructor. Do not use. The toggle value starts with false;


SchmidtTrigger

public SchmidtTrigger(String parameter)
Constructs a new Schmidt trigger. The two toggle values, off and on must be separated with a comma.


SchmidtTrigger

public SchmidtTrigger(double offtrig,
                      double ontrig)
Constructs a new Schmidt trigger. Note that the first argument, the off trigger must be less than the second argument, the on trigger.

Method Detail

setTriggers

protected void setTriggers(double offtrig,
                           double ontrig)
Sets the two trigger values. The first argument must be less than the second.


addHit

public boolean addHit(double val)
Return true, if the argument value is above the appropriate trigger. If the current state of the Schmidt trigger is on, than the on value is used, the off value otherwise.

Specified by:
addHit in interface Toggling

toString

public String toString()
Returns the two toggle edges as a description.

Overrides:
toString in class Object