|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.sj.Signal
public class Signal
Class that represents a signal as a part of a synchronous java (SJ) program. The represented signal is similar to the signal used in SyncCharts.
Field Summary | |
---|---|
static boolean |
ABSENT
One of the two possible status of a signal. |
protected boolean |
hasStateChecked
Used for a causality check to find out if a signal status is first checked and then emitted in the same tick. |
protected int |
index
Index to manage the last signal assignments. |
protected Boolean[] |
lastSignalAssignments
The last assignment of the signal used to get older states of the signal. |
protected boolean |
present
The current state of the signal. |
static boolean |
PRESENT
One of the two possible status of a signal. |
protected EmbeddedSJProgram<?> |
program
The program that belongs to the signal. |
Constructor Summary | |
---|---|
|
Signal(String signalName)
Creates a new signal with a given name. |
protected |
Signal(String signalName,
boolean state,
EmbeddedSJProgram<?> myProgram,
Boolean[] myLastSignalAssignments)
Creates a new signal. |
|
Signal(String signalName,
int historyLength)
Creates a new signal. |
Method Summary | |
---|---|
void |
emit()
Emits a signal. |
String |
getName()
Returns the name of a the signal. |
boolean |
isPresent()
Checks if a Signal is PRESENT . |
Signal |
pre()
Returns the previous instance of a signal. |
void |
sustainCB()
Sustains the signal. |
String |
toJSONString()
Returns a simple java script object notation for this object. |
String |
toString()
Returns a string representation of the signal. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean PRESENT
ABSENT
,
Constant Field Valuespublic static final boolean ABSENT
PRESENT
,
Constant Field Valuesprotected boolean present
protected Boolean[] lastSignalAssignments
protected int index
protected boolean hasStateChecked
protected EmbeddedSJProgram<?> program
Constructor Detail |
---|
public Signal(String signalName)
ABSENT
and if you want to get the last state you will get an Exception.
signalName
- The name of the created signalpublic Signal(String signalName, int historyLength)
ABSENT
. The previous signal states you
are able to ask for is the history length.
signalName
- The name of the created signal.historyLength
- The length we need for the signal history.pre()
protected Signal(String signalName, boolean state, EmbeddedSJProgram<?> myProgram, Boolean[] myLastSignalAssignments)
signalName
- The name of the signal.state
- The state of the signalmyProgram
- The program belonging to the signal.myLastSignalAssignments
- The last signal assignments belonging to the signal.Method Detail |
---|
public String getName()
public boolean isPresent()
PRESENT
.
Can used like this: ... if(signal1.present()){ ... }else{ ... }
Attention: Your are not allowed to change the state anymore after calling this method. This
is because a signal what checked as not present in a tick is not allowed to be present
during that tick.
true
) or not
false
.public void emit()
PRESENT
.
It will not be checked if a signal is emitted twice in a tick or has more than one
status during a tick.
public void sustainCB()
case
. The
B means that the next statement has to be a break
.
public Signal pre()
s.pre().pre()
is possible.
Signal(String, int)
public String toJSONString()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |