|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjaron.components.Signal
public class Signal
The Signal
class contains a single double value (signal) and
implements an EventListener
mechanism that allows its registered
listeners to be informed if the signal's value has changes.
By implementing the SignalListener
interface it can also receive
signal change events from other signals.
Constructor Summary | |
---|---|
Signal()
Creates a Signal object that contains a single double
value and implements the EventListener mechanism. |
|
Signal(double value)
Creates a Signal object that contains a single double
value and implements the EventListener mechanism. |
Method Summary | |
---|---|
void |
addSignalListener(SignalListener listener)
Adds the listener to the EventListener mechanism. |
double |
getBandwidth()
Returns the signal's bandwidth which is the high value minus the low value. |
double |
getHigh()
Returns the high value of the signal's bandwidth. |
double |
getLow()
Returns the low value of the signal's bandwidth. |
double |
getValue()
Returns the current value of the signal. |
void |
removeSignalListener(SignalListener listener)
Removes the listener from the EventListener mechanism. |
void |
setBandwidth(double low,
double high)
Sets the low and the high values of the signal. |
void |
setHigh(double value)
Sets the high value of the signal's bandwidth. |
void |
setLow(double value)
Sets the low value of the signal's bandwidth. |
void |
setValue(double value)
Sets the signal's value. |
void |
signalChanged(SignalEvent event)
Notifies the listener about a signal change event that occurred in the EventListener mechanism. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Signal(double value)
Signal
object that contains a single double
value and implements the EventListener
mechanism. By
default the signal's low value is set to -1 and high value is 1.
value
- a default value for the signalpublic Signal()
Signal
object that contains a single double
value and implements the EventListener
mechanism. By
default the signal's value is 0, its low value is set to -1 and the
high value is 1.
Method Detail |
---|
public void addSignalListener(SignalListener listener)
EventListener
mechanism. So whenever
the value of the signal changes, the listener will be informed.
listener
- the listener to be addedpublic double getBandwidth()
double
representing the signal's current bandwidthpublic double getHigh()
public double getLow()
public double getValue()
public void setBandwidth(double low, double high)
setLow
and setHigh
.
low
- the low end of the bandwidthhigh
- the high end of the bandwidthpublic void setHigh(double value)
value
- the signal's new high valuepublic void setLow(double value)
value
- the signal's new low valuepublic void setValue(double value)
SignalListener
EventListener
mechanism to set the signal's value.
setValue
in interface SignalListener
value
- the notifier's signal value that has changed or just the new signal valuepublic void signalChanged(SignalEvent event)
SignalListener
EventListener
mechanism.
signalChanged
in interface SignalListener
event
- the event that occurredpublic void removeSignalListener(SignalListener listener)
EventListener
mechanism. So in
the future the listener won't get informed about signal value changes anymore.
listener
- the listener to be removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |