Browse Source

VI51 - TP4 - Formation behaviors

master
Skia 3 years ago
parent
commit
af388a2118
100 changed files with 9119 additions and 0 deletions
  1. +3
    -0
      VI51-TP4-Formations/META-INF/MANIFEST.MF
  2. +328
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/SimulatorAgent.java
  3. +267
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/AbstractAnimat.java
  4. +147
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/PhysicEnvironment.java
  5. +410
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/StandardPhysicEnvironment.java
  6. +428
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/EnvironmentAgent.java
  7. +87
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/InfluenceEvent.java
  8. +107
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/PerceptionEvent.java
  9. +55
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/SimulationAgentReady.java
  10. +55
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/StartSimulation.java
  11. +55
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/StopSimulation.java
  12. +272
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/agent/Follower.java
  13. +292
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/agent/Leader.java
  14. +105
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/formation/Anchor.java
  15. +35
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/formation/CircleFormationFactory.java
  16. +34
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/formation/FIFOAssignmentPolicy.java
  17. +71
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/formation/Formation.java
  18. +11
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/formation/FormationAssignmentPolicy.java
  19. +8
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/formation/FormationFactory.java
  20. +23
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicAlignBehaviour.java
  21. +26
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicEvadeBehaviour.java
  22. +22
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicFaceBehaviour.java
  23. +23
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicFleeBehaviour.java
  24. +26
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicPursueBehaviour.java
  25. +23
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicSeekBehaviour.java
  26. +28
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicWanderBehaviour.java
  27. +52
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringAlignBehaviour.java
  28. +26
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringEvadeBehaviour.java
  29. +22
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringFaceBehaviour.java
  30. +23
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringFleeBehaviour.java
  31. +26
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringPursueBehaviour.java
  32. +23
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringSeekBehaviour.java
  33. +62
    -0
      VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringWanderBehaviour.java
  34. +2
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractMobileObject.properties
  35. +2
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractMobileObject_fr.properties
  36. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractSituatedObject.properties
  37. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractSituatedObject_fr.properties
  38. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/environment/AgentBody.properties
  39. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/environment/AgentBody_fr.properties
  40. +3
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/gui/AbstractFrameworkGUI.properties
  41. +3
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/gui/AbstractFrameworkGUI_fr.properties
  42. +3
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/gui/BehaviorTypeSelector.properties
  43. +3
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/gui/BehaviorTypeSelector_fr.properties
  44. BIN
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/gui/kinematic.png
  45. BIN
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/framework/gui/steering.png
  46. +4
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/MainProgram.properties
  47. +4
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/MainProgram_fr.properties
  48. +2
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/environment/WorldModel.properties
  49. +2
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/environment/WorldModel_fr.properties
  50. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/formation/BodyGuardFormationPattern.properties
  51. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/formation/BodyGuardFormationPattern_fr.properties
  52. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/formation/FormationSlot.properties
  53. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/formation/FormationSlot_fr.properties
  54. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/formation/VFormationPattern.properties
  55. +1
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/formation/VFormationPattern_fr.properties
  56. +3
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/gui/GUI.properties
  57. +3
    -0
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/gui/GUI_fr.properties
  58. BIN
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/gui/carrot.png
  59. BIN
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/gui/follower.png
  60. BIN
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/gui/icon.png
  61. BIN
      VI51-TP4-Formations/src/main/resources/fr/utbm/info/vi51/labwork4/gui/leader.png
  62. +124
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/FrameworkLauncher.java
  63. +154
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/agent/BehaviourOutput.java
  64. +78
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/agent/agent.sarl
  65. +45
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/agent/capacity.sarl
  66. +102
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/agent/skill.sarl
  67. +351
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/AbstractEnvironment.java
  68. +105
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/AbstractFrustum.java
  69. +347
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/AbstractMobileObject.java
  70. +220
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/AbstractSituatedObject.java
  71. +238
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/AgentBody.java
  72. +86
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/Body.java
  73. +39
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/DynamicType.java
  74. +98
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/Environment.java
  75. +60
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/EnvironmentEvent.java
  76. +39
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/EnvironmentListener.java
  77. +62
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/Frustum.java
  78. +72
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/Influence.java
  79. +41
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/KillInfluence.java
  80. +87
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/MobileObject.java
  81. +231
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/MotionInfluence.java
  82. +249
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/Percept.java
  83. +41
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/ShapedObject.java
  84. +80
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/SituatedObject.java
  85. +84
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/SpatialDataStructure.java
  86. +54
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/WorldModelState.java
  87. +113
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/environment.sarl
  88. +68
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/environment/events.sarl
  89. +518
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/gui/AbstractFrameworkGUI.java
  90. +118
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/gui/BehaviorTypeSelector.java
  91. +43
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/gui/FrameworkGUI.java
  92. +59
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/gui/WorldModelStateProvider.java
  93. +147
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/Circle2f.java
  94. +285
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/MathUtil.java
  95. +190
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/MotionHull2f.java
  96. +384
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/Point2f.java
  97. +190
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/Rectangle2f.java
  98. +76
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/Shape2f.java
  99. +622
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/Tuple2f.java
  100. +0
    -0
      VI51-TP4-Formations/src/main/sarl/fr/utbm/info/vi51/framework/math/Vector2f.java

+ 3
- 0
VI51-TP4-Formations/META-INF/MANIFEST.MF View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Created-By: 1.8.0_92 (Oracle Corporation)

+ 328
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/SimulatorAgent.java View File

@@ -0,0 +1,328 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework;

import fr.utbm.info.vi51.framework.environment.AgentBody;
import fr.utbm.info.vi51.framework.environment.DynamicType;
import fr.utbm.info.vi51.framework.environment.Environment;
import fr.utbm.info.vi51.framework.environment.EnvironmentAgent;
import fr.utbm.info.vi51.framework.environment.SimulationAgentReady;
import fr.utbm.info.vi51.framework.environment.StartSimulation;
import fr.utbm.info.vi51.framework.util.SpawnMapping;
import io.sarl.core.AgentKilled;
import io.sarl.core.AgentSpawned;
import io.sarl.core.DefaultContextInteractions;
import io.sarl.core.Destroy;
import io.sarl.core.Initialize;
import io.sarl.core.Lifecycle;
import io.sarl.lang.annotation.EarlyExit;
import io.sarl.lang.annotation.FiredEvent;
import io.sarl.lang.annotation.ImportedCapacityFeature;
import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Agent;
import io.sarl.lang.core.AgentContext;
import io.sarl.lang.core.BuiltinCapacitiesProvider;
import io.sarl.lang.core.Event;
import io.sarl.lang.core.EventSpace;
import io.sarl.lang.core.Percept;
import io.sarl.lang.core.Scope;
import io.sarl.lang.core.Space;
import io.sarl.lang.core.SpaceID;
import io.sarl.util.OpenEventSpace;
import io.sarl.util.OpenEventSpaceSpecification;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import javax.inject.Inject;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Conversions;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.Pure;

/**
* This agent is managing the simulator.
*
* @author St&eacute;phane GALLAND &lt;stephane.galland@utbm.fr&gt;
*/
@SarlSpecification("0.3")
@SuppressWarnings("all")
public class SimulatorAgent extends Agent {
protected int waitingAgents = 0;
@Percept
public void _handle_Initialize_0(final Initialize occurrence) {
Object _get = occurrence.parameters[0];
Environment environment = ((Environment) _get);
Object _get_1 = occurrence.parameters[1];
UUID spaceId = ((UUID) _get_1);
Object _get_2 = occurrence.parameters[2];
SpawnMapping spawnMapping = ((SpawnMapping) _get_2);
Object _get_3 = occurrence.parameters[3];
DynamicType behaviorType = ((DynamicType) _get_3);
AgentContext _defaultContext = this.getDefaultContext();
OpenEventSpace space = _defaultContext.<OpenEventSpace>getOrCreateSpaceWithID(spaceId, OpenEventSpaceSpecification.class);
this.avoidUnusedVariableWarning(space);
Iterable<? extends AgentBody> _agentBodies = environment.getAgentBodies();
int _size = IterableExtensions.size(_agentBodies);
int _plus = (_size + 1);
this.waitingAgents = _plus;
UUID environmentId = this.spawn(EnvironmentAgent.class, environment, spaceId);
List<Object> agentParameters = CollectionLiterals.<Object>newArrayList(spaceId, environmentId, behaviorType);
for (int i = 4; (i < ((List<Object>)Conversions.doWrapArray(occurrence.parameters)).size()); i++) {
Object _get_4 = occurrence.parameters[i];
agentParameters.add(_get_4);
}
Iterable<? extends AgentBody> _agentBodies_1 = environment.getAgentBodies();
for (final AgentBody body : _agentBodies_1) {
{
Class<? extends Agent> agentType = spawnMapping.getAgentTypeForBody(body);
UUID _iD = body.getID();
AgentContext _defaultContext_1 = this.getDefaultContext();
Object[] _array = agentParameters.toArray();
this.spawnInContextWithID(agentType, _iD, _defaultContext_1, _array);
}
}
}
private void avoidUnusedVariableWarning(final Object o) {
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Pure
private boolean _eventhandler_guard_SimulationAgentReady_1(final SimulationAgentReady it, final SimulationAgentReady occurrence) {
boolean _isFromMe = this.isFromMe(occurrence);
boolean _not = (!_isFromMe);
return _not;
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
private void _eventhandler_body_SimulationAgentReady_1(final SimulationAgentReady occurrence) {
synchronized (this) {
this.waitingAgents--;
if ((this.waitingAgents <= 0)) {
StartSimulation _startSimulation = new StartSimulation();
this.emit(_startSimulation);
this.killMe();
}
}
}
@Percept
public void _handle_SimulationAgentReady_1(final SimulationAgentReady occurrence) {
if (_eventhandler_guard_SimulationAgentReady_1(occurrence, occurrence)) {
_eventhandler_body_SimulationAgentReady_1(occurrence);
}
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void emit(final Event arg0) {
getSkill(io.sarl.core.DefaultContextInteractions.class).emit(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event,io.sarl.lang.core.Scope<io.sarl.lang.core.Address>)}.
*
* @see io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event,io.sarl.lang.core.Scope<io.sarl.lang.core.Address>)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void emit(final Event arg0, final Scope<Address> arg1) {
getSkill(io.sarl.core.DefaultContextInteractions.class).emit(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultAddress()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultAddress()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected Address getDefaultAddress() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultAddress();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultContext()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultContext()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected AgentContext getDefaultContext() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultContext();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultSpace()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultSpace()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected EventSpace getDefaultSpace() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultSpace();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultContext(io.sarl.lang.core.AgentContext)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultContext(io.sarl.lang.core.AgentContext)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultContext(final AgentContext arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultContext(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultContext(java.util.UUID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultContext(java.util.UUID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultContext(final UUID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultContext(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.Space)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.Space)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final Space arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.SpaceID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.SpaceID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final SpaceID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(java.util.UUID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(java.util.UUID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final UUID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isInDefaultSpace(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#isInDefaultSpace(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isInDefaultSpace(final Event arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isInDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#receive(java.util.UUID,io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#receive(java.util.UUID,io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void receive(final UUID arg0, final Event arg1) {
getSkill(io.sarl.core.DefaultContextInteractions.class).receive(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#spawn(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.lang.Object[])}.
*
* @see io.sarl.core.DefaultContextInteractions#spawn(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected UUID spawn(final Class<? extends Agent> arg0, final Object... arg1) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).spawn(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#killMe()}.
*
* @see io.sarl.core.Lifecycle#killMe()
*/
@EarlyExit
@FiredEvent({ AgentKilled.class, Destroy.class })
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected void killMe() {
getSkill(io.sarl.core.Lifecycle.class).killMe();
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#spawnInContext(java.lang.Class<? extends io.sarl.lang.core.Agent>,io.sarl.lang.core.AgentContext,java.lang.Object[])}.
*
* @see io.sarl.core.Lifecycle#spawnInContext(java.lang.Class<? extends io.sarl.lang.core.Agent>,io.sarl.lang.core.AgentContext,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected UUID spawnInContext(final Class<? extends Agent> arg0, final AgentContext arg1, final Object... arg2) {
return getSkill(io.sarl.core.Lifecycle.class).spawnInContext(arg0, arg1, arg2);
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#spawnInContextWithID(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.util.UUID,io.sarl.lang.core.AgentContext,java.lang.Object[])}.
*
* @see io.sarl.core.Lifecycle#spawnInContextWithID(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.util.UUID,io.sarl.lang.core.AgentContext,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected UUID spawnInContextWithID(final Class<? extends Agent> arg0, final UUID arg1, final AgentContext arg2, final Object... arg3) {
return getSkill(io.sarl.core.Lifecycle.class).spawnInContextWithID(arg0, arg1, arg2, arg3);
}
/**
* Construct an agent.
* @param builtinCapacityProvider - provider of the built-in capacities.
* @param parentID - identifier of the parent. It is the identifier of the parent agent and the enclosing contect, at the same time.
* @param agentID - identifier of the agent. If <code>null</code> the agent identifier will be computed randomly.
*/
@Inject
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public SimulatorAgent(final BuiltinCapacitiesProvider builtinCapacityProvider, final UUID parentID, final UUID agentID) {
super(builtinCapacityProvider, parentID, agentID);
}
}

+ 267
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/AbstractAnimat.java View File

@@ -0,0 +1,267 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.agent;

import com.google.common.base.Objects;
import fr.utbm.info.vi51.framework.agent.BehaviourOutput;
import fr.utbm.info.vi51.framework.agent.PhysicEnvironment;
import fr.utbm.info.vi51.framework.agent.StandardPhysicEnvironment;
import fr.utbm.info.vi51.framework.environment.DynamicType;
import fr.utbm.info.vi51.framework.environment.Influence;
import fr.utbm.info.vi51.framework.environment.StopSimulation;
import fr.utbm.info.vi51.framework.math.Vector2f;
import io.sarl.core.AgentKilled;
import io.sarl.core.AgentSpawned;
import io.sarl.core.Destroy;
import io.sarl.core.Initialize;
import io.sarl.core.Lifecycle;
import io.sarl.lang.annotation.EarlyExit;
import io.sarl.lang.annotation.FiredEvent;
import io.sarl.lang.annotation.ImportedCapacityFeature;
import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Agent;
import io.sarl.lang.core.AgentContext;
import io.sarl.lang.core.BuiltinCapacitiesProvider;
import io.sarl.lang.core.Percept;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import javax.inject.Inject;
import org.eclipse.xtext.xbase.lib.Pure;

@SarlSpecification("0.3")
@SuppressWarnings("all")
public class AbstractAnimat extends Agent {
protected DynamicType behaviorType;
@Percept
public void _handle_Initialize_0(final Initialize occurrence) {
Object _get = occurrence.parameters[0];
Object _get_1 = occurrence.parameters[1];
StandardPhysicEnvironment physicSkill = new StandardPhysicEnvironment(
((UUID) _get),
((UUID) _get_1));
Object _get_2 = occurrence.parameters[2];
this.behaviorType = ((DynamicType) _get_2);
this.<StandardPhysicEnvironment>setSkill(PhysicEnvironment.class, physicSkill);
}
@Pure
protected float getMaxLinear(final fr.utbm.info.vi51.framework.environment.Percept p) {
float _xifexpression = (float) 0;
boolean _equals = Objects.equal(this.behaviorType, DynamicType.STEERING);
if (_equals) {
_xifexpression = p.getMaxLinearAcceleration();
} else {
_xifexpression = p.getMaxLinearSpeed();
}
return _xifexpression;
}
@Pure
protected float getMaxAngular(final fr.utbm.info.vi51.framework.environment.Percept p) {
float _xifexpression = (float) 0;
boolean _equals = Objects.equal(this.behaviorType, DynamicType.STEERING);
if (_equals) {
_xifexpression = p.getMaxAngularAcceleration();
} else {
_xifexpression = p.getMaxAngularSpeed();
}
return _xifexpression;
}
protected void emitInfluence(final BehaviourOutput output, final Influence... influences) {
if ((output != null)) {
DynamicType _type = output.getType();
boolean _tripleEquals = (_type == DynamicType.STEERING);
if (_tripleEquals) {
Vector2f _linear = output.getLinear();
float _angular = output.getAngular();
this.influenceSteering(_linear, _angular, influences);
} else {
Vector2f _linear_1 = output.getLinear();
float _angular_1 = output.getAngular();
this.influenceKinematic(_linear_1, _angular_1, influences);
}
} else {
Vector2f _vector2f = new Vector2f();
this.influenceSteering(_vector2f, 0f, influences);
}
}
protected void doNothing() {
Vector2f _vector2f = new Vector2f();
this.influenceKinematic(_vector2f, 0f);
}
protected fr.utbm.info.vi51.framework.environment.Percept first(final List<fr.utbm.info.vi51.framework.environment.Percept> list) {
fr.utbm.info.vi51.framework.environment.Percept _xifexpression = null;
boolean _isEmpty = list.isEmpty();
if (_isEmpty) {
_xifexpression = null;
} else {
_xifexpression = list.get(0);
}
return _xifexpression;
}
@Percept
public void _handle_StopSimulation_1(final StopSimulation occurrence) {
this.killMe();
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceKinematic(final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceKinematic(otherInfluences);
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(float,fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(float,fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceKinematic(final float angularInfluence, final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceKinematic(angularInfluence, otherInfluences);
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(fr.utbm.info.vi51.framework.math.Vector2f,fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(fr.utbm.info.vi51.framework.math.Vector2f,fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceKinematic(final Vector2f linearInfluence, final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceKinematic(linearInfluence, otherInfluences);
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceKinematic(fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceKinematic(final Vector2f linearInfluence, final float angularInfluence, final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceKinematic(linearInfluence, angularInfluence, otherInfluences);
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceSteering(final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceSteering(otherInfluences);
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(float,fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(float,fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceSteering(final float angularInfluence, final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceSteering(angularInfluence, otherInfluences);
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(fr.utbm.info.vi51.framework.math.Vector2f,fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(fr.utbm.info.vi51.framework.math.Vector2f,fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceSteering(final Vector2f linearInfluence, final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceSteering(linearInfluence, otherInfluences);
}
/**
* See the capacity {@link fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence[])}.
*
* @see fr.utbm.info.vi51.framework.agent.PhysicEnvironment#influenceSteering(fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence[])
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(PhysicEnvironment.class)
protected void influenceSteering(final Vector2f linearInfluence, final float angularInfluence, final Influence... otherInfluences) {
getSkill(fr.utbm.info.vi51.framework.agent.PhysicEnvironment.class).influenceSteering(linearInfluence, angularInfluence, otherInfluences);
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#killMe()}.
*
* @see io.sarl.core.Lifecycle#killMe()
*/
@EarlyExit
@FiredEvent({ AgentKilled.class, Destroy.class })
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected void killMe() {
getSkill(io.sarl.core.Lifecycle.class).killMe();
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#spawnInContext(java.lang.Class<? extends io.sarl.lang.core.Agent>,io.sarl.lang.core.AgentContext,java.lang.Object[])}.
*
* @see io.sarl.core.Lifecycle#spawnInContext(java.lang.Class<? extends io.sarl.lang.core.Agent>,io.sarl.lang.core.AgentContext,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected UUID spawnInContext(final Class<? extends Agent> arg0, final AgentContext arg1, final Object... arg2) {
return getSkill(io.sarl.core.Lifecycle.class).spawnInContext(arg0, arg1, arg2);
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#spawnInContextWithID(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.util.UUID,io.sarl.lang.core.AgentContext,java.lang.Object[])}.
*
* @see io.sarl.core.Lifecycle#spawnInContextWithID(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.util.UUID,io.sarl.lang.core.AgentContext,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected UUID spawnInContextWithID(final Class<? extends Agent> arg0, final UUID arg1, final AgentContext arg2, final Object... arg3) {
return getSkill(io.sarl.core.Lifecycle.class).spawnInContextWithID(arg0, arg1, arg2, arg3);
}
/**
* Construct an agent.
* @param builtinCapacityProvider - provider of the built-in capacities.
* @param parentID - identifier of the parent. It is the identifier of the parent agent and the enclosing contect, at the same time.
* @param agentID - identifier of the agent. If <code>null</code> the agent identifier will be computed randomly.
*/
@Inject
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public AbstractAnimat(final BuiltinCapacitiesProvider builtinCapacityProvider, final UUID parentID, final UUID agentID) {
super(builtinCapacityProvider, parentID, agentID);
}
}

+ 147
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/PhysicEnvironment.java View File

@@ -0,0 +1,147 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.agent;

import fr.utbm.info.vi51.framework.environment.Influence;
import fr.utbm.info.vi51.framework.math.Vector2f;
import io.sarl.lang.annotation.DefaultValue;
import io.sarl.lang.annotation.DefaultValueSource;
import io.sarl.lang.annotation.DefaultValueUse;
import io.sarl.lang.annotation.SarlSourceCode;
import io.sarl.lang.core.Capacity;
import javax.annotation.Generated;

@SuppressWarnings("all")
public interface PhysicEnvironment extends Capacity {
/**
* Invoked to send the influence to the environment.
*
* @param linearInfluence is the linear influence to apply on the object.
* @param angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueSource
public abstract void influenceKinematic(@DefaultValue("fr.utbm.info.vi51.framework.agent.PhysicEnvironment#INFLUENCEKINEMATIC_0") final Vector2f linearInfluence, @DefaultValue("fr.utbm.info.vi51.framework.agent.PhysicEnvironment#INFLUENCEKINEMATIC_1") final float angularInfluence, final Influence... otherInfluences);
/**
* Default value for the parameter linearInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" null")
public final static Vector2f ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_0 = null;
/**
* Default value for the parameter angularInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" 0f")
public final static float ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_1 = 0f;
/**
* Invoked to send the influence to the environment.
*
* @param linearInfluence is the linear influence to apply on the object.
* @param angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueSource
public abstract void influenceSteering(@DefaultValue("fr.utbm.info.vi51.framework.agent.PhysicEnvironment#INFLUENCESTEERING_0") final Vector2f linearInfluence, @DefaultValue("fr.utbm.info.vi51.framework.agent.PhysicEnvironment#INFLUENCESTEERING_1") final float angularInfluence, final Influence... otherInfluences);
/**
* Default value for the parameter linearInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" null")
public final static Vector2f ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_0 = null;
/**
* Default value for the parameter angularInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" 0f")
public final static float ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_1 = 0f;
/**
* Invoked to send the influence to the environment.
*
* @optionalparam linearInfluence is the linear influence to apply on the object.
* @optionalparam angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public abstract void influenceKinematic(final Influence... otherInfluences);
/**
* Invoked to send the influence to the environment.
*
* @optionalparam linearInfluence is the linear influence to apply on the object.
* @param angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public abstract void influenceKinematic(final float angularInfluence, final Influence... otherInfluences);
/**
* Invoked to send the influence to the environment.
*
* @param linearInfluence is the linear influence to apply on the object.
* @optionalparam angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public abstract void influenceKinematic(final Vector2f linearInfluence, final Influence... otherInfluences);
/**
* Invoked to send the influence to the environment.
*
* @optionalparam linearInfluence is the linear influence to apply on the object.
* @optionalparam angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public abstract void influenceSteering(final Influence... otherInfluences);
/**
* Invoked to send the influence to the environment.
*
* @optionalparam linearInfluence is the linear influence to apply on the object.
* @param angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public abstract void influenceSteering(final float angularInfluence, final Influence... otherInfluences);
/**
* Invoked to send the influence to the environment.
*
* @param linearInfluence is the linear influence to apply on the object.
* @optionalparam angularInfluence is the angular influence to apply on the object.
* @param otherInfluences other influences to emit in parallel to the motion influence.
*/
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public abstract void influenceSteering(final Vector2f linearInfluence, final Influence... otherInfluences);
}

+ 410
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/StandardPhysicEnvironment.java View File

@@ -0,0 +1,410 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.agent;

import fr.utbm.info.vi51.framework.agent.PhysicEnvironment;
import fr.utbm.info.vi51.framework.environment.DynamicType;
import fr.utbm.info.vi51.framework.environment.Influence;
import fr.utbm.info.vi51.framework.environment.InfluenceEvent;
import fr.utbm.info.vi51.framework.environment.KillInfluence;
import fr.utbm.info.vi51.framework.environment.MotionInfluence;
import fr.utbm.info.vi51.framework.math.Vector2f;
import fr.utbm.info.vi51.framework.util.AddressUUIDScope;
import io.sarl.core.AgentSpawned;
import io.sarl.core.Behaviors;
import io.sarl.core.DefaultContextInteractions;
import io.sarl.lang.annotation.DefaultValue;
import io.sarl.lang.annotation.DefaultValueSource;
import io.sarl.lang.annotation.DefaultValueUse;
import io.sarl.lang.annotation.FiredEvent;
import io.sarl.lang.annotation.ImportedCapacityFeature;
import io.sarl.lang.annotation.SarlSourceCode;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Agent;
import io.sarl.lang.core.AgentContext;
import io.sarl.lang.core.Behavior;
import io.sarl.lang.core.Event;
import io.sarl.lang.core.EventListener;
import io.sarl.lang.core.EventSpace;
import io.sarl.lang.core.Scope;
import io.sarl.lang.core.Skill;
import io.sarl.lang.core.Space;
import io.sarl.lang.core.SpaceID;
import io.sarl.util.OpenEventSpace;
import java.lang.reflect.Array;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.eclipse.xtext.xbase.lib.Conversions;

@SuppressWarnings("all")
public class StandardPhysicEnvironment extends Skill implements PhysicEnvironment {
protected final UUID spaceID;
protected final UUID environmentID;
protected OpenEventSpace physicSpace;
protected Address myAdr;
public StandardPhysicEnvironment(final UUID spaceID, final UUID environmentID) {
this.environmentID = environmentID;
this.spaceID = spaceID;
}
@Override
public void install() {
do {
{
AgentContext _defaultContext = this.getDefaultContext();
OpenEventSpace _space = _defaultContext.<OpenEventSpace>getSpace(this.spaceID);
this.physicSpace = _space;
Thread.yield();
}
} while((this.physicSpace == null));
EventListener _asEventListener = this.asEventListener();
this.physicSpace.register(_asEventListener);
Agent _owner = this.getOwner();
UUID _iD = _owner.getID();
Address _address = this.physicSpace.getAddress(_iD);
this.myAdr = _address;
}
@Override
public void uninstall() {
KillInfluence _killInfluence = new KillInfluence();
InfluenceEvent event = new InfluenceEvent(_killInfluence);
event.setSource(this.myAdr);
AddressUUIDScope _addressUUIDScope = new AddressUUIDScope(this.environmentID);
this.physicSpace.emit(event, _addressUUIDScope);
this.physicSpace = null;
}
@DefaultValueSource
@Override
public void influenceKinematic(@DefaultValue("fr.utbm.info.vi51.framework.agent.StandardPhysicEnvironment#INFLUENCEKINEMATIC_0") final Vector2f linearInfluence, @DefaultValue("fr.utbm.info.vi51.framework.agent.StandardPhysicEnvironment#INFLUENCEKINEMATIC_1") final float angularInfluence, final Influence... otherInfluences) {
MotionInfluence mi = null;
boolean _tripleEquals = linearInfluence.operator_tripleEquals(null);
if (_tripleEquals) {
MotionInfluence _motionInfluence = new MotionInfluence(DynamicType.KINEMATIC, angularInfluence);
mi = _motionInfluence;
} else {
MotionInfluence _motionInfluence_1 = new MotionInfluence(DynamicType.KINEMATIC, linearInfluence, angularInfluence);
mi = _motionInfluence_1;
}
this.emitInfluences(mi, otherInfluences);
}
/**
* Default value for the parameter linearInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" null")
private final static Vector2f ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_0 = null;
/**
* Default value for the parameter angularInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" 0f")
private final static float ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_1 = 0f;
@DefaultValueSource
@Override
public void influenceSteering(@DefaultValue("fr.utbm.info.vi51.framework.agent.StandardPhysicEnvironment#INFLUENCESTEERING_0") final Vector2f linearInfluence, @DefaultValue("fr.utbm.info.vi51.framework.agent.StandardPhysicEnvironment#INFLUENCESTEERING_1") final float angularInfluence, final Influence... otherInfluences) {
MotionInfluence mi = null;
boolean _tripleEquals = linearInfluence.operator_tripleEquals(null);
if (_tripleEquals) {
MotionInfluence _motionInfluence = new MotionInfluence(DynamicType.STEERING, angularInfluence);
mi = _motionInfluence;
} else {
MotionInfluence _motionInfluence_1 = new MotionInfluence(DynamicType.STEERING, linearInfluence, angularInfluence);
mi = _motionInfluence_1;
}
this.emitInfluences(mi, otherInfluences);
}
/**
* Default value for the parameter linearInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" null")
private final static Vector2f ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_0 = null;
/**
* Default value for the parameter angularInfluence
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@SarlSourceCode(" 0f")
private final static float ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_1 = 0f;
public void emitInfluences(final MotionInfluence motionInfluence, final Influence... otherInfluences) {
Influence[] influences = null;
boolean _isEmpty = ((List<Influence>)Conversions.doWrapArray(otherInfluences)).isEmpty();
if (_isEmpty) {
Object _newInstance = Array.newInstance(Influence.class, 1);
influences = ((Influence[]) _newInstance);
influences[0] = motionInfluence;
} else {
int _length = otherInfluences.length;
int _plus = (_length + 1);
Object _newInstance_1 = Array.newInstance(Influence.class, _plus);
influences = ((Influence[]) _newInstance_1);
influences[0] = motionInfluence;
int _length_1 = otherInfluences.length;
System.arraycopy(otherInfluences, 0, influences, 1, _length_1);
}
InfluenceEvent event = new InfluenceEvent(influences);
event.setSource(this.myAdr);
AddressUUIDScope _addressUUIDScope = new AddressUUIDScope(this.environmentID);
this.physicSpace.emit(event, _addressUUIDScope);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void emit(final Event arg0) {
getSkill(io.sarl.core.DefaultContextInteractions.class).emit(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event,io.sarl.lang.core.Scope<io.sarl.lang.core.Address>)}.
*
* @see io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event,io.sarl.lang.core.Scope<io.sarl.lang.core.Address>)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void emit(final Event arg0, final Scope<Address> arg1) {
getSkill(io.sarl.core.DefaultContextInteractions.class).emit(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultAddress()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultAddress()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected Address getDefaultAddress() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultAddress();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultContext()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultContext()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected AgentContext getDefaultContext() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultContext();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultSpace()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultSpace()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected EventSpace getDefaultSpace() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultSpace();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultContext(io.sarl.lang.core.AgentContext)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultContext(io.sarl.lang.core.AgentContext)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultContext(final AgentContext arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultContext(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultContext(java.util.UUID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultContext(java.util.UUID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultContext(final UUID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultContext(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.Space)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.Space)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final Space arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.SpaceID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.SpaceID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final SpaceID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(java.util.UUID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(java.util.UUID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final UUID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isInDefaultSpace(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#isInDefaultSpace(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isInDefaultSpace(final Event arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isInDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#receive(java.util.UUID,io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#receive(java.util.UUID,io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void receive(final UUID arg0, final Event arg1) {
getSkill(io.sarl.core.DefaultContextInteractions.class).receive(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#spawn(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.lang.Object[])}.
*
* @see io.sarl.core.DefaultContextInteractions#spawn(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected UUID spawn(final Class<? extends Agent> arg0, final Object... arg1) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).spawn(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.Behaviors#asEventListener()}.
*
* @see io.sarl.core.Behaviors#asEventListener()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected EventListener asEventListener() {
return getSkill(io.sarl.core.Behaviors.class).asEventListener();
}
/**
* See the capacity {@link io.sarl.core.Behaviors#registerBehavior(io.sarl.lang.core.Behavior)}.
*
* @see io.sarl.core.Behaviors#registerBehavior(io.sarl.lang.core.Behavior)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected Behavior registerBehavior(final Behavior arg0) {
return getSkill(io.sarl.core.Behaviors.class).registerBehavior(arg0);
}
/**
* See the capacity {@link io.sarl.core.Behaviors#unregisterBehavior(io.sarl.lang.core.Behavior)}.
*
* @see io.sarl.core.Behaviors#unregisterBehavior(io.sarl.lang.core.Behavior)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected Behavior unregisterBehavior(final Behavior arg0) {
return getSkill(io.sarl.core.Behaviors.class).unregisterBehavior(arg0);
}
/**
* See the capacity {@link io.sarl.core.Behaviors#wake(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.Behaviors#wake(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected void wake(final Event arg0) {
getSkill(io.sarl.core.Behaviors.class).wake(arg0);
}
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Override
public final void influenceKinematic(final Influence... otherInfluences) {
influenceKinematic(___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_0, ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_1, otherInfluences);
}
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Override
public final void influenceKinematic(final float angularInfluence, final Influence... otherInfluences) {
influenceKinematic(___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_0, angularInfluence, otherInfluences);
}
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Override
public final void influenceKinematic(final Vector2f linearInfluence, final Influence... otherInfluences) {
influenceKinematic(linearInfluence, ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCEKINEMATIC_1, otherInfluences);
}
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Override
public final void influenceSteering(final Influence... otherInfluences) {
influenceSteering(___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_0, ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_1, otherInfluences);
}
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Override
public final void influenceSteering(final float angularInfluence, final Influence... otherInfluences) {
influenceSteering(___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_0, angularInfluence, otherInfluences);
}
@DefaultValueUse("fr.utbm.info.vi51.framework.math.Vector2f,float,fr.utbm.info.vi51.framework.environment.Influence*")
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Override
public final void influenceSteering(final Vector2f linearInfluence, final Influence... otherInfluences) {
influenceSteering(linearInfluence, ___FORMAL_PARAMETER_DEFAULT_VALUE_INFLUENCESTEERING_1, otherInfluences);
}
}

+ 428
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/EnvironmentAgent.java View File

@@ -0,0 +1,428 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.environment;

import fr.utbm.info.vi51.framework.environment.AgentBody;
import fr.utbm.info.vi51.framework.environment.Environment;
import fr.utbm.info.vi51.framework.environment.Influence;
import fr.utbm.info.vi51.framework.environment.InfluenceEvent;
import fr.utbm.info.vi51.framework.environment.PerceptionEvent;
import fr.utbm.info.vi51.framework.environment.SimulationAgentReady;
import fr.utbm.info.vi51.framework.environment.StartSimulation;
import fr.utbm.info.vi51.framework.environment.StopSimulation;
import fr.utbm.info.vi51.framework.time.TimeManager;
import fr.utbm.info.vi51.framework.time.TimePercept;
import fr.utbm.info.vi51.framework.util.AddressUUIDScope;
import io.sarl.core.AgentKilled;
import io.sarl.core.AgentSpawned;
import io.sarl.core.Behaviors;
import io.sarl.core.DefaultContextInteractions;
import io.sarl.core.Destroy;
import io.sarl.core.Initialize;
import io.sarl.core.Lifecycle;
import io.sarl.lang.annotation.EarlyExit;
import io.sarl.lang.annotation.FiredEvent;
import io.sarl.lang.annotation.ImportedCapacityFeature;
import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Agent;
import io.sarl.lang.core.AgentContext;
import io.sarl.lang.core.Behavior;
import io.sarl.lang.core.BuiltinCapacitiesProvider;
import io.sarl.lang.core.Event;
import io.sarl.lang.core.EventListener;
import io.sarl.lang.core.EventSpace;
import io.sarl.lang.core.Percept;
import io.sarl.lang.core.Scope;
import io.sarl.lang.core.Space;
import io.sarl.lang.core.SpaceID;
import io.sarl.util.OpenEventSpace;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Generated;
import javax.inject.Inject;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Pure;

/**
* This agent is managing the physic space.
*
* @author St&eacute;phane GALLAND &lt;stephane.galland@utbm.fr&gt;
*/
@SarlSpecification("0.3")
@SuppressWarnings("all")
public class EnvironmentAgent extends Agent {
protected Environment environment;
protected OpenEventSpace space;
protected Address myAdr;
protected int influences = 0;
protected final AtomicBoolean freeze = new AtomicBoolean(false);
@Percept
public void _handle_Initialize_0(final Initialize occurrence) {
Object _get = occurrence.parameters[0];
this.environment = ((Environment) _get);
Object _get_1 = occurrence.parameters[1];
UUID spaceId = ((UUID) _get_1);
AgentContext _defaultContext = this.getDefaultContext();
OpenEventSpace _space = _defaultContext.<OpenEventSpace>getSpace(spaceId);
this.space = _space;
EventListener _asEventListener = this.asEventListener();
this.space.register(_asEventListener);
UUID _iD = this.getID();
Address _address = this.space.getAddress(_iD);
this.myAdr = _address;
SimulationAgentReady _simulationAgentReady = new SimulationAgentReady();
this.emit(_simulationAgentReady);
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Pure
private boolean _eventhandler_guard_InfluenceEvent_1(final InfluenceEvent it, final InfluenceEvent occurrence) {
boolean _get = this.freeze.get();
boolean _not = (!_get);
return _not;
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
private void _eventhandler_body_InfluenceEvent_1(final InfluenceEvent occurrence) {
for (final Influence influence : occurrence.influences) {
{
UUID id = influence.getEmitter();
if ((id == null)) {
Address _source = occurrence.getSource();
UUID _uUID = _source.getUUID();
id = _uUID;
}
AgentBody body = this.environment.getAgentBodyFor(id);
body.influence(influence);
}
}
this.influences++;
int _agentBodyNumber = this.environment.getAgentBodyNumber();
boolean _greaterEqualsThan = (this.influences >= _agentBodyNumber);
if (_greaterEqualsThan) {
this.runEnvironmentBehavior();
}
}
@Percept
public void _handle_InfluenceEvent_1(final InfluenceEvent occurrence) {
if (_eventhandler_guard_InfluenceEvent_1(occurrence, occurrence)) {
_eventhandler_body_InfluenceEvent_1(occurrence);
}
}
@Percept
public void _handle_StopSimulation_2(final StopSimulation occurrence) {
this.killMe();
}
@Percept
public void _handle_StartSimulation_3(final StartSimulation occurrence) {
this.runEnvironmentBehavior();
}
protected void runEnvironmentBehavior() {
try {
this.freeze.set(true);
this.influences = 0;
this.environment.runBehaviour();
TimeManager _timeManager = this.environment.getTimeManager();
float _simulationDelay = _timeManager.getSimulationDelay();
long delay = ((long) _simulationDelay);
if ((delay > 0)) {
Thread.sleep(delay);
}
this.freeze.set(false);
this.notifyAgentsOrDie();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
protected void notifyAgentsOrDie() {
boolean run = false;
TimeManager _timeManager = this.environment.getTimeManager();
float _currentTime = _timeManager.getCurrentTime();
TimeManager _timeManager_1 = this.environment.getTimeManager();
float _lastStepDuration = _timeManager_1.getLastStepDuration();
final TimePercept timePercept = new TimePercept(_currentTime, _lastStepDuration);
Iterable<? extends AgentBody> _agentBodies = this.environment.getAgentBodies();
for (final AgentBody body : _agentBodies) {
{
run = true;
List<fr.utbm.info.vi51.framework.environment.Percept> _perceivedObjects = body.getPerceivedObjects();
fr.utbm.info.vi51.framework.environment.Percept _percept = new fr.utbm.info.vi51.framework.environment.Percept(body);
PerceptionEvent event = new PerceptionEvent(_perceivedObjects, _percept, timePercept);
event.setSource(this.myAdr);
UUID _iD = body.getID();
AddressUUIDScope _addressUUIDScope = new AddressUUIDScope(_iD);
this.space.emit(event, _addressUUIDScope);
}
}
if ((!run)) {
this.killMe();
}
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void emit(final Event arg0) {
getSkill(io.sarl.core.DefaultContextInteractions.class).emit(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event,io.sarl.lang.core.Scope<io.sarl.lang.core.Address>)}.
*
* @see io.sarl.core.DefaultContextInteractions#emit(io.sarl.lang.core.Event,io.sarl.lang.core.Scope<io.sarl.lang.core.Address>)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void emit(final Event arg0, final Scope<Address> arg1) {
getSkill(io.sarl.core.DefaultContextInteractions.class).emit(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultAddress()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultAddress()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected Address getDefaultAddress() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultAddress();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultContext()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultContext()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected AgentContext getDefaultContext() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultContext();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#getDefaultSpace()}.
*
* @see io.sarl.core.DefaultContextInteractions#getDefaultSpace()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected EventSpace getDefaultSpace() {
return getSkill(io.sarl.core.DefaultContextInteractions.class).getDefaultSpace();
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultContext(io.sarl.lang.core.AgentContext)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultContext(io.sarl.lang.core.AgentContext)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultContext(final AgentContext arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultContext(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultContext(java.util.UUID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultContext(java.util.UUID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultContext(final UUID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultContext(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.Space)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.Space)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final Space arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.SpaceID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(io.sarl.lang.core.SpaceID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final SpaceID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isDefaultSpace(java.util.UUID)}.
*
* @see io.sarl.core.DefaultContextInteractions#isDefaultSpace(java.util.UUID)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isDefaultSpace(final UUID arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#isInDefaultSpace(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#isInDefaultSpace(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected boolean isInDefaultSpace(final Event arg0) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).isInDefaultSpace(arg0);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#receive(java.util.UUID,io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.DefaultContextInteractions#receive(java.util.UUID,io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected void receive(final UUID arg0, final Event arg1) {
getSkill(io.sarl.core.DefaultContextInteractions.class).receive(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.DefaultContextInteractions#spawn(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.lang.Object[])}.
*
* @see io.sarl.core.DefaultContextInteractions#spawn(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(DefaultContextInteractions.class)
protected UUID spawn(final Class<? extends Agent> arg0, final Object... arg1) {
return getSkill(io.sarl.core.DefaultContextInteractions.class).spawn(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#killMe()}.
*
* @see io.sarl.core.Lifecycle#killMe()
*/
@EarlyExit
@FiredEvent({ AgentKilled.class, Destroy.class })
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected void killMe() {
getSkill(io.sarl.core.Lifecycle.class).killMe();
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#spawnInContext(java.lang.Class<? extends io.sarl.lang.core.Agent>,io.sarl.lang.core.AgentContext,java.lang.Object[])}.
*
* @see io.sarl.core.Lifecycle#spawnInContext(java.lang.Class<? extends io.sarl.lang.core.Agent>,io.sarl.lang.core.AgentContext,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected UUID spawnInContext(final Class<? extends Agent> arg0, final AgentContext arg1, final Object... arg2) {
return getSkill(io.sarl.core.Lifecycle.class).spawnInContext(arg0, arg1, arg2);
}
/**
* See the capacity {@link io.sarl.core.Lifecycle#spawnInContextWithID(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.util.UUID,io.sarl.lang.core.AgentContext,java.lang.Object[])}.
*
* @see io.sarl.core.Lifecycle#spawnInContextWithID(java.lang.Class<? extends io.sarl.lang.core.Agent>,java.util.UUID,io.sarl.lang.core.AgentContext,java.lang.Object[])
*/
@FiredEvent(AgentSpawned.class)
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Lifecycle.class)
protected UUID spawnInContextWithID(final Class<? extends Agent> arg0, final UUID arg1, final AgentContext arg2, final Object... arg3) {
return getSkill(io.sarl.core.Lifecycle.class).spawnInContextWithID(arg0, arg1, arg2, arg3);
}
/**
* See the capacity {@link io.sarl.core.Behaviors#asEventListener()}.
*
* @see io.sarl.core.Behaviors#asEventListener()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected EventListener asEventListener() {
return getSkill(io.sarl.core.Behaviors.class).asEventListener();
}
/**
* See the capacity {@link io.sarl.core.Behaviors#registerBehavior(io.sarl.lang.core.Behavior)}.
*
* @see io.sarl.core.Behaviors#registerBehavior(io.sarl.lang.core.Behavior)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected Behavior registerBehavior(final Behavior arg0) {
return getSkill(io.sarl.core.Behaviors.class).registerBehavior(arg0);
}
/**
* See the capacity {@link io.sarl.core.Behaviors#unregisterBehavior(io.sarl.lang.core.Behavior)}.
*
* @see io.sarl.core.Behaviors#unregisterBehavior(io.sarl.lang.core.Behavior)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected Behavior unregisterBehavior(final Behavior arg0) {
return getSkill(io.sarl.core.Behaviors.class).unregisterBehavior(arg0);
}
/**
* See the capacity {@link io.sarl.core.Behaviors#wake(io.sarl.lang.core.Event)}.
*
* @see io.sarl.core.Behaviors#wake(io.sarl.lang.core.Event)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Behaviors.class)
protected void wake(final Event arg0) {
getSkill(io.sarl.core.Behaviors.class).wake(arg0);
}
/**
* Construct an agent.
* @param builtinCapacityProvider - provider of the built-in capacities.
* @param parentID - identifier of the parent. It is the identifier of the parent agent and the enclosing contect, at the same time.
* @param agentID - identifier of the agent. If <code>null</code> the agent identifier will be computed randomly.
*/
@Inject
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public EnvironmentAgent(final BuiltinCapacitiesProvider builtinCapacityProvider, final UUID parentID, final UUID agentID) {
super(builtinCapacityProvider, parentID, agentID);
}
}

+ 87
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/InfluenceEvent.java View File

@@ -0,0 +1,87 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.environment;

import fr.utbm.info.vi51.framework.environment.Influence;
import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Event;
import java.util.List;
import javax.annotation.Generated;
import org.eclipse.xtext.xbase.lib.Conversions;
import org.eclipse.xtext.xbase.lib.Pure;

/**
* This event contains an influence
*
* @author St&eacute;phane GALLAND &lt;stephane.galland@utbm.fr&gt;
*/
@SarlSpecification("0.3")
@SuppressWarnings("all")
public class InfluenceEvent extends Event {
public final List<Influence> influences;
public InfluenceEvent(final Influence... e) {
this.influences = ((List<Influence>)Conversions.doWrapArray(e));
}
@Override
@Pure
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
InfluenceEvent other = (InfluenceEvent) obj;
if (this.influences == null) {
if (other.influences != null)
return false;
} else if (!this.influences.equals(other.influences))
return false;
return super.equals(obj);
}
@Override
@Pure
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((this.influences== null) ? 0 : this.influences.hashCode());
return result;
}
/**
* Returns a String representation of the InfluenceEvent event's attributes only.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Pure
protected String attributesToString() {
StringBuilder result = new StringBuilder(super.attributesToString());
result.append("influences = ").append(this.influences);
return result.toString();
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
private final static long serialVersionUID = 5240104421L;
}

+ 107
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/PerceptionEvent.java View File

@@ -0,0 +1,107 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.environment;

import fr.utbm.info.vi51.framework.environment.Percept;
import fr.utbm.info.vi51.framework.time.TimePercept;
import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Event;
import java.util.List;
import javax.annotation.Generated;
import org.eclipse.xtext.xbase.lib.Pure;

/**
* This event contains percepts.
*
* @author St&eacute;phane GALLAND &lt;stephane.galland@utbm.fr&gt;
*/
@SarlSpecification("0.3")
@SuppressWarnings("all")
public class PerceptionEvent extends Event {
public final Percept body;
public final TimePercept time;
public final List<Percept> perceptions;
public PerceptionEvent(final List<Percept> p, final Percept b, final TimePercept t) {
this.perceptions = p;
this.body = b;
this.time = t;
}
@Override
@Pure
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PerceptionEvent other = (PerceptionEvent) obj;
if (this.body == null) {
if (other.body != null)
return false;
} else if (!this.body.equals(other.body))
return false;
if (this.time == null) {
if (other.time != null)
return false;
} else if (!this.time.equals(other.time))
return false;
if (this.perceptions == null) {
if (other.perceptions != null)
return false;
} else if (!this.perceptions.equals(other.perceptions))
return false;
return super.equals(obj);
}
@Override
@Pure
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((this.body== null) ? 0 : this.body.hashCode());
result = prime * result + ((this.time== null) ? 0 : this.time.hashCode());
result = prime * result + ((this.perceptions== null) ? 0 : this.perceptions.hashCode());
return result;
}
/**
* Returns a String representation of the PerceptionEvent event's attributes only.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@Pure
protected String attributesToString() {
StringBuilder result = new StringBuilder(super.attributesToString());
result.append("body = ").append(this.body);
result.append("time = ").append(this.time);
result.append("perceptions = ").append(this.perceptions);
return result.toString();
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
private final static long serialVersionUID = 2892685776L;
}

+ 55
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/SimulationAgentReady.java View File

@@ -0,0 +1,55 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.environment;

import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Event;
import javax.annotation.Generated;

/**
* This event is fired when a simulation agent is ready.
*
* @author St&eacute;phane GALLAND &lt;stephane.galland@utbm.fr&gt;
*/
@SarlSpecification("0.3")
@SuppressWarnings("all")
public class SimulationAgentReady extends Event {
/**
* Construct an event. The source of the event is unknown.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public SimulationAgentReady() {
super();
}
/**
* Construct an event.
* @param source - address of the agent that is emitting this event.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public SimulationAgentReady(final Address source) {
super(source);
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
private final static long serialVersionUID = 588368462L;
}

+ 55
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/StartSimulation.java View File

@@ -0,0 +1,55 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.environment;

import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Event;
import javax.annotation.Generated;

/**
* This event is for starting the simulation.
*
* @author St&eacute;phane GALLAND &lt;stephane.galland@utbm.fr&gt;
*/
@SarlSpecification("0.3")
@SuppressWarnings("all")
public class StartSimulation extends Event {
/**
* Construct an event. The source of the event is unknown.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public StartSimulation() {
super();
}
/**
* Construct an event.
* @param source - address of the agent that is emitting this event.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public StartSimulation(final Address source) {
super(source);
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
private final static long serialVersionUID = 588368462L;
}

+ 55
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/StopSimulation.java View File

@@ -0,0 +1,55 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.framework.environment;

import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Event;
import javax.annotation.Generated;

/**
* This event is for stopping the simulation.
*
* @author St&eacute;phane GALLAND &lt;stephane.galland@utbm.fr&gt;
*/
@SarlSpecification("0.3")
@SuppressWarnings("all")
public class StopSimulation extends Event {
/**
* Construct an event. The source of the event is unknown.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public StopSimulation() {
super();
}
/**
* Construct an event.
* @param source - address of the agent that is emitting this event.
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
public StopSimulation(final Address source) {
super(source);
}
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
private final static long serialVersionUID = 588368462L;
}

+ 272
- 0
VI51-TP4-Formations/src/main/generated-sources/sarl/fr/utbm/info/vi51/labwork4/agent/Follower.java View File

@@ -0,0 +1,272 @@
/**
* $Id$
*
* Copyright (c) 2014-15 Stephane GALLAND <stephane.galland@utbm.fr>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* This program is free software; you can redistribute it and/or modify
*/
package fr.utbm.info.vi51.labwork4.agent;

import fr.utbm.info.vi51.framework.agent.AbstractAnimat;
import fr.utbm.info.vi51.framework.agent.BehaviourOutput;
import fr.utbm.info.vi51.framework.environment.DynamicType;
import fr.utbm.info.vi51.framework.environment.PerceptionEvent;
import fr.utbm.info.vi51.framework.environment.SimulationAgentReady;
import fr.utbm.info.vi51.framework.math.Point2f;
import fr.utbm.info.vi51.framework.math.Vector2f;
import fr.utbm.info.vi51.labwork4.formation.Anchor;
import fr.utbm.info.vi51.labwork4.formation.FormationAssignmentPolicy;
import fr.utbm.info.vi51.motionbehavior.AlignBehaviour;
import fr.utbm.info.vi51.motionbehavior.FaceBehaviour;
import fr.utbm.info.vi51.motionbehavior.KinematicAlignBehaviour;
import fr.utbm.info.vi51.motionbehavior.KinematicFaceBehaviour;
import fr.utbm.info.vi51.motionbehavior.KinematicSeekBehaviour;
import fr.utbm.info.vi51.motionbehavior.KinematicWanderBehaviour;
import fr.utbm.info.vi51.motionbehavior.SeekBehaviour;
import fr.utbm.info.vi51.motionbehavior.WanderBehaviour;
import io.sarl.core.AgentSpawned;
import io.sarl.core.DefaultContextInteractions;
import io.sarl.core.Initialize;
import io.sarl.lang.annotation.FiredEvent;
import io.sarl.lang.annotation.ImportedCapacityFeature;
import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Agent;
import io.sarl.lang.core.AgentContext;
import io.sarl.lang.core.BuiltinCapacitiesProvider;
import io.sarl.lang.core.Event;
import io.sarl.lang.core.EventSpace;