-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ehsan Khamespanah
committed
Aug 15, 2023
1 parent
47d7f97
commit 0df8ecc
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/test/resources/org/rebecalang/compiler/adhoc/VarSensorImmediate.rebeca
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
env int BUFFER_SIZE = 4; | ||
|
||
reactiveclass Sensor(3) { | ||
statevars{ | ||
CompUnit cu; | ||
} | ||
|
||
Sensor(CompUnit cu1) { | ||
cu = cu1; | ||
self.gatherData(); | ||
} | ||
|
||
msgsrv gatherData() { | ||
cu.receiveData(0); | ||
self.gatherData() after(?(1,2,3)); | ||
} | ||
} | ||
|
||
|
||
reactiveclass CompUnit(3) { | ||
statevars { | ||
Network network; | ||
} | ||
|
||
CompUnit(Network net) { | ||
network = net; | ||
} | ||
|
||
msgsrv receiveData(byte data) { | ||
network.send(data); | ||
} | ||
|
||
} | ||
|
||
interface Network { | ||
msgsrv send(byte data); | ||
} | ||
|
||
reactiveclass MACBNetwork implements Network(3) { | ||
msgsrv send(byte data) { | ||
// Send data according | ||
// to the MACB protocol | ||
} | ||
} | ||
|
||
reactiveclass TDMANetwork implements Network(3) { | ||
msgsrv send(byte data) { | ||
// Send data according | ||
// to the TDMA protocol | ||
} | ||
} | ||
|
||
main { | ||
Sensor sensor():(cu); | ||
CompUnit cu():(network); | ||
TDMANetwork network():(); | ||
} |