de.cau.cs.kieler.krep.evalbench.comm
Class Signal

java.lang.Object
  extended by de.cau.cs.kieler.krep.evalbench.comm.Signal
All Implemented Interfaces:
Comparable<Signal>

public class Signal
extends Object
implements Comparable<Signal>

Pure or valued signal for the synchronous signal model.

Rating yellow
(2010-02-05) review by cmot, msp

Constructor Summary
Signal(Signal s)
          generate a new signal by copying.
Signal(String n, boolean s, Integer v, HashMap<String,Integer> tIndex)
          Creates and initializes a signal.
Signal(String tName, boolean tStatus, Integer tValue, Integer tIndex)
          generate Signal with explicit index.
Signal(String tName, Integer tValue)
          generate new signal.
 
Method Summary
 int compareTo(Signal o)
          
 boolean equals(Object o)
           
 int getIndex()
          Get the signal index.
 String getName()
          Get the signal name.
 boolean getPresent()
          Get the current signal status.
 Object getValue()
          Get the signal value.
 int hashCode()
           
 boolean isValued()
          Check whether this is a valued signal.
 void setIndex(int tIndex)
          Set the signal index.
 void setPresent(boolean b)
          Set the current signal status.
 void setValue(Object x)
          Set the signal value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Signal

public Signal(String n,
              boolean s,
              Integer v,
              HashMap<String,Integer> tIndex)
Creates and initializes a signal. Depending of the input this will be either a valued or an unvalued signal.

Parameters:
n - signal name
s - initial status of the signal
v - value of the signal, null for pure signal
tIndex - signal index

Signal

public Signal(String tName,
              boolean tStatus,
              Integer tValue,
              Integer tIndex)
generate Signal with explicit index.

Parameters:
tName - name of the signal
tStatus - initial status
tValue - value if valued, null for pure signal
tIndex - index in the current program

Signal

public Signal(Signal s)
generate a new signal by copying.

Parameters:
s - signal to copy

Signal

public Signal(String tName,
              Integer tValue)
generate new signal. Signals are initially absent

Parameters:
tName - name of the signal
tValue - initial value for a valued signal, null for a pure signal
Method Detail

isValued

public boolean isValued()
Check whether this is a valued signal.

Returns:
true if the signal is valued

getIndex

public int getIndex()
Get the signal index.

Returns:
signal index

setIndex

public void setIndex(int tIndex)
Set the signal index.

Parameters:
tIndex - signal index

getPresent

public boolean getPresent()
Get the current signal status.

Returns:
true if the signal is present

setPresent

public void setPresent(boolean b)
Set the current signal status.

Parameters:
b - new status

getValue

public Object getValue()
Get the signal value.

Returns:
current signal value, or null if its value has not been initialized yet.

setValue

public void setValue(Object x)
Set the signal value.

Parameters:
x - new value

getName

public String getName()
Get the signal name.

Returns:
signal name

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(Signal o)

Specified by:
compareTo in interface Comparable<Signal>