Skip to content

Commit

Permalink
[lang][core] Rename agentId to participantId into Address.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Mar 15, 2020
1 parent ccc5dfd commit dc92d68
Showing 1 changed file with 15 additions and 17 deletions.
Expand Up @@ -28,10 +28,11 @@
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;

/**
* This class describes all the addresses used by the kernel to identify its
* elements.
* This class describes all the addresses used by the space to identify its
* participants.
*
* @author $Author: srodriguez$
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
Expand All @@ -40,23 +41,20 @@ public class Address extends SRESpecificDataContainer implements Serializable, C

private static final long serialVersionUID = 1519844913685586094L;

/**
* The global unique identifier of this kernel.
*/
private final UUID agentId;
private final UUID participantId;

private final SpaceID spaceId;

/**
* Create an address based on the specified identifier.
*
* @param spaceId the identifier of the space related to this address.
* @param agentId is the identifier of the address.
* @param participantId is the identifier of the participant.
*/
public Address(SpaceID spaceId, UUID agentId) {
assert agentId != null;
public Address(SpaceID spaceId, UUID participantId) {
assert participantId != null;
assert spaceId != null;
this.agentId = agentId;
this.participantId = participantId;
this.spaceId = spaceId;
}

Expand All @@ -65,26 +63,26 @@ public Address(SpaceID spaceId, UUID agentId) {
public String toString() {
final ToStringBuilder builder = new ToStringBuilder(this);
builder.add("type", getClass().getSimpleName()); //$NON-NLS-1$
builder.add("agentId", this.agentId); //$NON-NLS-1$
builder.add("participantId", this.participantId); //$NON-NLS-1$
builder.add("spaceId", this.spaceId); //$NON-NLS-1$
return builder.toString();
}

/**
* Replies the identifier associated to this address.
* Replies the participant identifier associated to this address.
*
* @return the identifier associated to this address.
* @return the participant identifier associated to this address.
*/
@Pure
public UUID getUUID() {
return this.agentId;
return this.participantId;
}

@Override
@Pure
public int hashCode() {
int result = 1;
result = 31 * result + ((this.agentId == null) ? 0 : this.agentId.hashCode());
result = 31 * result + ((this.participantId == null) ? 0 : this.participantId.hashCode());
result = 31 * result + ((this.spaceId == null) ? 0 : this.spaceId.hashCode());
return result;
}
Expand Down Expand Up @@ -115,7 +113,7 @@ public boolean equals(Object obj) {
*/
@Pure
public boolean equals(Address address) {
return address != null && this.agentId.equals(address.getUUID())
return address != null && this.participantId.equals(address.getUUID())
&& this.spaceId.equals(address.getSpaceID());
}

Expand Down Expand Up @@ -159,7 +157,7 @@ public int compareTo(Address address) {
if (address == null) {
return 1;
}
return this.agentId.compareTo(address.getUUID());
return this.participantId.compareTo(address.getUUID());
}

/** Replies the ID of the space related to this address.
Expand Down

0 comments on commit dc92d68

Please sign in to comment.