Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding management of ParticipantLeft and ParticipantJoined, and utnin…
…g sequencing system events Closes: #72 Closes: #941 adding scope from ParticipantLeft/Joined, MemberJoined/Left, and ContextJoined/Left. SpaceCreated/Destroyed are not impacted beacause not sent by agents but spaces. AgentSpawned/Killed was already scoped
- Loading branch information
Showing
4 changed files
with
183 additions
and
40 deletions.
There are no files selected for viewing
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,85 @@ | ||
/* | ||
* $Id$ | ||
* | ||
* SARL is an general-purpose agent programming language. | ||
* More details on http://www.sarl.io | ||
* | ||
* Copyright (C) 2014-2019 the original authors or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.sarl.util | ||
|
||
import io.sarl.lang.core.Address | ||
import io.sarl.lang.core.SpaceID | ||
import java.util.UUID | ||
|
||
/** Notifies other participants the member with agentID has effectively | ||
* integrated the space. | ||
* The event is fired within the default space of the context in which the agent entered a new space. | ||
* The joining agent does not receive this event. | ||
* The source of the event is the entering agent. | ||
*/ | ||
final event ParticipantJoined { | ||
|
||
/** The identifier of the space in which the agent is entering. | ||
*/ | ||
val spaceID : SpaceID | ||
|
||
/** The identifier of the agent that has entered the space. | ||
*/ | ||
val agentID : UUID | ||
|
||
/** Construct the event. | ||
* | ||
* @param source the address of the emitter. | ||
* @param spaceID the identifier of the space. | ||
* @param agentID the identifier of the agent. | ||
*/ | ||
new (source : Address, spaceID : SpaceID, agentID : UUID) { | ||
setSource(source) | ||
this.spaceID = spaceID | ||
this.agentID = agentID | ||
} | ||
|
||
} | ||
|
||
/** Notifies other participants the member with agentID has effectively | ||
* left the space. | ||
* The event is fired within the default space of the context in which the agent left the space. | ||
* The leaving agent does not receive this event. | ||
* The source of the event is the leaving agent. | ||
*/ | ||
final event ParticipantLeft { | ||
|
||
/** The identifier of the space the agent just left. | ||
*/ | ||
val spaceID : SpaceID | ||
|
||
/** The identifier of the agent that has left the space. | ||
*/ | ||
val agentID : UUID | ||
|
||
/** Construct the event. | ||
* | ||
* @param source the address of the emitter. | ||
* @param spaceID the identifier of the space. | ||
* @param agentID the identifier of the agent. | ||
*/ | ||
new (source : Address, spaceID : SpaceID, agentID : UUID) { | ||
setSource(source) | ||
this.spaceID = spaceID | ||
this.agentID = agentID | ||
} | ||
|
||
} |
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
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
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