You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicclassUnitAgentextendsAbstractAgent {
@SwimLane("people")
ValueLane<Integer> people = this.valueLane();
@SwimLane("addPeople")
CommandLane<Integer> addPeople = this.<Integer>commandLane().onCommand(msg -> {
this.people.set(this.people.get() + msg);
});
@SwimLane("join")
JoinValueLane<Integer, Integer> join = this.<Integer, Integer>joinValueLane().didUpdate((Integerkey, IntegernewValue, IntegeroldValue) -> {
System.out.println("The people in room " + key + " are " + newValue + " from " + oldValue);
});
@OverridepublicvoiddidStart() {
join.downlink(1).nodeUri("/swim").laneUri("people").open().didSet((newValue, oldValue) -> {
System.out.println("people changed to " + newValue + " from " + oldValue);
});
}
}
Input
@command(node:"/swim", lane:"addPeople")5
Output
The people in room 1 are 0 from 0
people changed to 0 from 0
The people in room 1 are 0 from 0
The people in room 1 are 5 from 0
people changed to 5 from 5
The people in room 1 are 5 from 5
The first three messages are from the initial value and the next three are from the command.
The text was updated successfully, but these errors were encountered:
Similar to #67 but with a slightly different output, potentially due to #65.
Example:
BasicPlane.java
UnitAgent.java
Input
Output
The first three messages are from the initial value and the next three are from the command.
The text was updated successfully, but these errors were encountered: