stella.util
Class ValueToggle

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

public class ValueToggle
extends Object
implements Toggling

A simple toggle. Oscilates between two states, depending on the value handed over on construct. If the added value is below the toggle value, false is returned by the Toggling method.


Field Summary
private  double toggle
          The toggle value.
 
Constructor Summary
ValueToggle(double mean)
          Constructs a new toggle value.
ValueToggle(String val)
          Constructs a new value toggle.
 
Method Summary
 boolean addHit(double newval)
          Test if the added value is above or below the toggle value.
 String toString()
          Returns the toggling value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

toggle

private double toggle
The toggle value.

Constructor Detail

ValueToggle

public ValueToggle(String val)
Constructs a new value toggle. The argument string is parsed to a double.


ValueToggle

public ValueToggle(double mean)
Constructs a new toggle value.

Method Detail

addHit

public boolean addHit(double newval)
Test if the added value is above or below the toggle value. No history is taken into account.

Specified by:
addHit in interface Toggling
Returns:
True, if the argument is ≥ the toggle value

toString

public String toString()
Returns the toggling value.

Overrides:
toString in class Object