Browse Source

Add SARL project with Guy

sarl
Skia 3 years ago
parent
commit
0d1182404b
100 changed files with 4496 additions and 4 deletions
  1. +10
    -3
      .classpath
  2. +8
    -1
      .project
  3. +4
    -0
      .settings/io.sarl.lang.SARL.prefs
  4. +11
    -0
      .settings/org.eclipse.jdt.core.prefs
  5. +3
    -0
      META-INF/MANIFEST.MF
  6. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/eurock/agent/.Guy.java._trace
  7. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/eurock/agent/.guy.sarlbin
  8. +468
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/eurock/agent/Guy.java
  9. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/.SimulatorAgent.java._trace
  10. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/.simulator.sarlbin
  11. +328
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/SimulatorAgent.java
  12. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.AbstractAnimat.java._trace
  13. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.PhysicEnvironment.java._trace
  14. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.StandardPhysicEnvironment.java._trace
  15. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.agent.sarlbin
  16. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.capacity.sarlbin
  17. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.skill.sarlbin
  18. +267
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/AbstractAnimat.java
  19. +147
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/PhysicEnvironment.java
  20. +410
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/StandardPhysicEnvironment.java
  21. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.EnvironmentAgent.java._trace
  22. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.InfluenceEvent.java._trace
  23. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.PerceptionEvent.java._trace
  24. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.SimulationAgentReady.java._trace
  25. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.StartSimulation.java._trace
  26. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.StopSimulation.java._trace
  27. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.environment.sarlbin
  28. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.events.sarlbin
  29. +428
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/EnvironmentAgent.java
  30. +87
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/InfluenceEvent.java
  31. +107
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/PerceptionEvent.java
  32. +55
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/SimulationAgentReady.java
  33. +55
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/StartSimulation.java
  34. +55
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/StopSimulation.java
  35. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicAlignBehaviour.java._trace
  36. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicBehaviours.sarlbin
  37. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicEvadeBehaviour.java._trace
  38. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicFaceBehaviour.java._trace
  39. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicFleeBehaviour.java._trace
  40. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicPursueBehaviour.java._trace
  41. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicSeekBehaviour.java._trace
  42. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.KinematicWanderBehaviour.java._trace
  43. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringAlignBehaviour.java._trace
  44. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringBehaviours.sarlbin
  45. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringEvadeBehaviour.java._trace
  46. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringFaceBehaviour.java._trace
  47. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringFleeBehaviour.java._trace
  48. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringPursueBehaviour.java._trace
  49. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringSeekBehaviour.java._trace
  50. BIN
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/.SteeringWanderBehaviour.java._trace
  51. +23
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicAlignBehaviour.java
  52. +26
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicEvadeBehaviour.java
  53. +22
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicFaceBehaviour.java
  54. +23
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicFleeBehaviour.java
  55. +26
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicPursueBehaviour.java
  56. +23
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicSeekBehaviour.java
  57. +28
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/KinematicWanderBehaviour.java
  58. +52
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringAlignBehaviour.java
  59. +26
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringEvadeBehaviour.java
  60. +22
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringFaceBehaviour.java
  61. +23
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringFleeBehaviour.java
  62. +26
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringPursueBehaviour.java
  63. +23
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringSeekBehaviour.java
  64. +62
    -0
      src/main/generated-sources/sarl/fr/utbm/info/vi51/motionbehavior/SteeringWanderBehaviour.java
  65. +4
    -0
      src/main/resources/fr/utbm/info/vi51/eurock/MainProgram.properties
  66. +4
    -0
      src/main/resources/fr/utbm/info/vi51/eurock/MainProgram_fr.properties
  67. +3
    -0
      src/main/resources/fr/utbm/info/vi51/eurock/gui/GUI.properties
  68. +3
    -0
      src/main/resources/fr/utbm/info/vi51/eurock/gui/GUI_fr.properties
  69. BIN
      src/main/resources/fr/utbm/info/vi51/eurock/gui/carrot.png
  70. BIN
      src/main/resources/fr/utbm/info/vi51/eurock/gui/follower.png
  71. BIN
      src/main/resources/fr/utbm/info/vi51/eurock/gui/icon.png
  72. BIN
      src/main/resources/fr/utbm/info/vi51/eurock/gui/leader.png
  73. +2
    -0
      src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractMobileObject.properties
  74. +2
    -0
      src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractMobileObject_fr.properties
  75. +1
    -0
      src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractSituatedObject.properties
  76. +1
    -0
      src/main/resources/fr/utbm/info/vi51/framework/environment/AbstractSituatedObject_fr.properties
  77. +1
    -0
      src/main/resources/fr/utbm/info/vi51/framework/environment/AgentBody.properties
  78. +1
    -0
      src/main/resources/fr/utbm/info/vi51/framework/environment/AgentBody_fr.properties
  79. BIN
      src/main/resources/fr/utbm/info/vi51/framework/eurock/gui/icon.png
  80. +3
    -0
      src/main/resources/fr/utbm/info/vi51/framework/gui/AbstractFrameworkGUI.properties
  81. +3
    -0
      src/main/resources/fr/utbm/info/vi51/framework/gui/AbstractFrameworkGUI_fr.properties
  82. +3
    -0
      src/main/resources/fr/utbm/info/vi51/framework/gui/BehaviorTypeSelector.properties
  83. +3
    -0
      src/main/resources/fr/utbm/info/vi51/framework/gui/BehaviorTypeSelector_fr.properties
  84. BIN
      src/main/resources/fr/utbm/info/vi51/framework/gui/kinematic.png
  85. BIN
      src/main/resources/fr/utbm/info/vi51/framework/gui/steering.png
  86. +85
    -0
      src/main/sarl/fr/utbm/info/vi51/eurock/MainProgram.java
  87. +86
    -0
      src/main/sarl/fr/utbm/info/vi51/eurock/agent/guy.sarl
  88. +28
    -0
      src/main/sarl/fr/utbm/info/vi51/eurock/environment/CircleFrustrum.java
  89. +59
    -0
      src/main/sarl/fr/utbm/info/vi51/eurock/environment/MouseTarget.java
  90. +49
    -0
      src/main/sarl/fr/utbm/info/vi51/eurock/environment/WallObject.java
  91. +285
    -0
      src/main/sarl/fr/utbm/info/vi51/eurock/environment/WorldModel.java
  92. +170
    -0
      src/main/sarl/fr/utbm/info/vi51/eurock/gui/GUI.java
  93. BIN
      src/main/sarl/fr/utbm/info/vi51/eurock/gui/icon.png
  94. +122
    -0
      src/main/sarl/fr/utbm/info/vi51/framework/FrameworkLauncher.java
  95. +154
    -0
      src/main/sarl/fr/utbm/info/vi51/framework/agent/BehaviourOutput.java
  96. +78
    -0
      src/main/sarl/fr/utbm/info/vi51/framework/agent/agent.sarl
  97. +45
    -0
      src/main/sarl/fr/utbm/info/vi51/framework/agent/capacity.sarl
  98. +102
    -0
      src/main/sarl/fr/utbm/info/vi51/framework/agent/skill.sarl
  99. +351
    -0
      src/main/sarl/fr/utbm/info/vi51/framework/environment/AbstractEnvironment.java
  100. +0
    -0
      src/main/sarl/fr/utbm/info/vi51/framework/environment/AbstractFrustum.java

+ 10
- 3
.classpath View File

@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path=""/>
<classpathentry kind="src" path="src/main/sarl"/>
<classpathentry kind="src" path="src/main/generated-sources/sarl">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="/home/skia/Documents/UTBM/GI04/VI51/TP2 - SARL/io.janusproject.kernel-2.0.3.1-with-dependencies.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

+ 8
- 1
.project View File

@@ -1,17 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>VI51-Project</name>
<name>VI51-TP5-Boids</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>io.sarl.eclipse.SARLProjectNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

+ 4
- 0
.settings/io.sarl.lang.SARL.prefs View File

@@ -0,0 +1,4 @@
BuilderConfiguration.is_project_specific=true
eclipse.preferences.version=1
is_project_specific=true
outlet.DEFAULT_OUTPUT.cleanDirectory=true

+ 11
- 0
.settings/org.eclipse.jdt.core.prefs View File

@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

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

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

BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/eurock/agent/.Guy.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/eurock/agent/.guy.sarlbin View File


+ 468
- 0
src/main/generated-sources/sarl/fr/utbm/info/vi51/eurock/agent/Guy.java View File

@@ -0,0 +1,468 @@
/**
* $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.eurock.agent;

import com.google.common.base.Objects;
import fr.utbm.info.vi51.framework.agent.AbstractAnimat;
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.motionbehavior.AlignBehaviour;
import fr.utbm.info.vi51.motionbehavior.KinematicAlignBehaviour;
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.core.Logging;
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 java.io.Serializable;
import java.util.Random;
import java.util.UUID;
import javax.annotation.Generated;
import javax.inject.Inject;

@SarlSpecification("0.3")
@SuppressWarnings("all")
public class Guy extends AbstractAnimat {
protected SeekBehaviour seekBehaviour;
protected WanderBehaviour wanderBehaviour;
protected AlignBehaviour alignBehaviour;
@Percept
public void _handle_Initialize_0(final Initialize occurrence) {
super._handle_Initialize_0(occurrence);
SimulationAgentReady _simulationAgentReady = new SimulationAgentReady();
this.emit(_simulationAgentReady);
KinematicSeekBehaviour _kinematicSeekBehaviour = new KinematicSeekBehaviour();
this.seekBehaviour = _kinematicSeekBehaviour;
KinematicAlignBehaviour _kinematicAlignBehaviour = new KinematicAlignBehaviour();
this.alignBehaviour = _kinematicAlignBehaviour;
KinematicWanderBehaviour _kinematicWanderBehaviour = new KinematicWanderBehaviour();
this.wanderBehaviour = _kinematicWanderBehaviour;
}
@Percept
public void _handle_PerceptionEvent_1(final PerceptionEvent occurrence) {
fr.utbm.info.vi51.framework.environment.Percept body = occurrence.body;
Vector2f direction = new Vector2f();
Random random = new Random();
Vector2f barycenter = new Vector2f();
Vector2f f = new Vector2f();
int _size = occurrence.perceptions.size();
boolean _greaterThan = (_size > 0);
if (_greaterThan) {
for (final fr.utbm.info.vi51.framework.environment.Percept o : occurrence.perceptions) {
Serializable _type = o.getType();
boolean _equals = Objects.equal(_type, "FISH");
if (_equals) {
Point2f _position = o.getPosition();
Point2f _position_1 = body.getPosition();
Vector2f _minus = _position.operator_minus(_position_1);
barycenter.operator_add(_minus);
Vector2f _direction = o.getDirection();
direction.operator_add(_direction);
Point2f _position_2 = body.getPosition();
Point2f _position_3 = o.getPosition();
Vector2f _minus_1 = _position_2.operator_minus(_position_3);
Vector2f _multiply = _minus_1.operator_multiply(4);
Point2f _position_4 = body.getPosition();
Point2f _position_5 = o.getPosition();
Vector2f _minus_2 = _position_4.operator_minus(_position_5);
float _length = _minus_2.length();
double _power = Math.pow(_length, 1);
double _plus = (_power + 1);
Vector2f _divide = _multiply.operator_divide(((float) _plus));
f.operator_add(_divide);
} else {
Serializable _type_1 = o.getType();
boolean _equals_1 = Objects.equal(_type_1, "TARGET");
if (_equals_1) {
Point2f _position_6 = o.getPosition();
Point2f _position_7 = body.getPosition();
Vector2f _minus_3 = _position_6.operator_minus(_position_7);
Vector2f _multiply_1 = _minus_3.operator_multiply(5);
barycenter.operator_add(_multiply_1);
Point2f _position_8 = o.getPosition();
Point2f _position_9 = body.getPosition();
Vector2f _minus_4 = _position_8.operator_minus(_position_9);
direction.operator_add(_minus_4);
Point2f _position_10 = body.getPosition();
Point2f _position_11 = o.getPosition();
Vector2f _minus_5 = _position_10.operator_minus(_position_11);
Vector2f _unitVector = _minus_5.toUnitVector();
Point2f _position_12 = body.getPosition();
Point2f _position_13 = o.getPosition();
Vector2f _minus_6 = _position_12.operator_minus(_position_13);
float _length_1 = _minus_6.length();
double _power_1 = Math.pow(_length_1, 8);
double _plus_1 = (_power_1 + 1);
Vector2f _divide_1 = _unitVector.operator_divide(((float) _plus_1));
f.operator_add(_divide_1);
}
}
}
Vector2f _barycenter = barycenter;
int _size_1 = occurrence.perceptions.size();
double _divide_2 = (1.0 / _size_1);
barycenter = _barycenter.operator_multiply(((float) _divide_2));
direction.operator_add(barycenter);
Vector2f _plus_2 = barycenter.operator_plus(f);
Vector2f _direction_1 = body.getDirection();
float _signedAngle = _direction_1.signedAngle(direction);
this.influenceKinematic(_plus_2, _signedAngle);
} else {
int _nextInt = random.nextInt();
int _nextInt_1 = random.nextInt();
Vector2f linear = new Vector2f(((float) _nextInt), ((float) _nextInt_1));
double _nextGaussian = random.nextGaussian();
float angular = ((float) _nextGaussian);
this.influenceKinematic(linear, angular);
}
}
/**
* 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.Logging#debug(java.lang.Object)}.
*
* @see io.sarl.core.Logging#debug(java.lang.Object)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void debug(final Object arg0) {
getSkill(io.sarl.core.Logging.class).debug(arg0);
}
/**
* See the capacity {@link io.sarl.core.Logging#error(java.lang.Object)}.
*
* @see io.sarl.core.Logging#error(java.lang.Object)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void error(final Object arg0) {
getSkill(io.sarl.core.Logging.class).error(arg0);
}
/**
* See the capacity {@link io.sarl.core.Logging#error(java.lang.Object,java.lang.Throwable)}.
*
* @see io.sarl.core.Logging#error(java.lang.Object,java.lang.Throwable)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void error(final Object arg0, final Throwable arg1) {
getSkill(io.sarl.core.Logging.class).error(arg0, arg1);
}
/**
* See the capacity {@link io.sarl.core.Logging#getLogLevel()}.
*
* @see io.sarl.core.Logging#getLogLevel()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected int getLogLevel() {
return getSkill(io.sarl.core.Logging.class).getLogLevel();
}
/**
* See the capacity {@link io.sarl.core.Logging#info(java.lang.Object)}.
*
* @see io.sarl.core.Logging#info(java.lang.Object)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void info(final Object arg0) {
getSkill(io.sarl.core.Logging.class).info(arg0);
}
/**
* See the capacity {@link io.sarl.core.Logging#isDebugLogEnabled()}.
*
* @see io.sarl.core.Logging#isDebugLogEnabled()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected boolean isDebugLogEnabled() {
return getSkill(io.sarl.core.Logging.class).isDebugLogEnabled();
}
/**
* See the capacity {@link io.sarl.core.Logging#isErrorLogEnabled()}.
*
* @see io.sarl.core.Logging#isErrorLogEnabled()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected boolean isErrorLogEnabled() {
return getSkill(io.sarl.core.Logging.class).isErrorLogEnabled();
}
/**
* See the capacity {@link io.sarl.core.Logging#isInfoLogEnabled()}.
*
* @see io.sarl.core.Logging#isInfoLogEnabled()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected boolean isInfoLogEnabled() {
return getSkill(io.sarl.core.Logging.class).isInfoLogEnabled();
}
/**
* See the capacity {@link io.sarl.core.Logging#isWarningLogEnabled()}.
*
* @see io.sarl.core.Logging#isWarningLogEnabled()
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected boolean isWarningLogEnabled() {
return getSkill(io.sarl.core.Logging.class).isWarningLogEnabled();
}
/**
* See the capacity {@link io.sarl.core.Logging#println(java.lang.Object)}.
*
* @see io.sarl.core.Logging#println(java.lang.Object)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void println(final Object arg0) {
getSkill(io.sarl.core.Logging.class).println(arg0);
}
/**
* See the capacity {@link io.sarl.core.Logging#setLogLevel(int)}.
*
* @see io.sarl.core.Logging#setLogLevel(int)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void setLogLevel(final int arg0) {
getSkill(io.sarl.core.Logging.class).setLogLevel(arg0);
}
/**
* See the capacity {@link io.sarl.core.Logging#setLoggingName(java.lang.String)}.
*
* @see io.sarl.core.Logging#setLoggingName(java.lang.String)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void setLoggingName(final String arg0) {
getSkill(io.sarl.core.Logging.class).setLoggingName(arg0);
}
/**
* See the capacity {@link io.sarl.core.Logging#warning(java.lang.Object)}.
*
* @see io.sarl.core.Logging#warning(java.lang.Object)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void warning(final Object arg0) {
getSkill(io.sarl.core.Logging.class).warning(arg0);
}
/**
* See the capacity {@link io.sarl.core.Logging#warning(java.lang.Object,java.lang.Throwable)}.
*
* @see io.sarl.core.Logging#warning(java.lang.Object,java.lang.Throwable)
*/
@Generated("io.sarl.lang.jvmmodel.SARLJvmModelInferrer")
@ImportedCapacityFeature(Logging.class)
protected void warning(final Object arg0, final Throwable arg1) {
getSkill(io.sarl.core.Logging.class).warning(arg0, arg1);
}
/**
* 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 Guy(final BuiltinCapacitiesProvider builtinCapacityProvider, final UUID parentID, final UUID agentID) {
super(builtinCapacityProvider, parentID, agentID);
}
}

BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/.SimulatorAgent.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/.simulator.sarlbin View File


+ 328
- 0
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);
}
}

BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.AbstractAnimat.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.PhysicEnvironment.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.StandardPhysicEnvironment.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.agent.sarlbin View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.capacity.sarlbin View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/agent/.skill.sarlbin View File


+ 267
- 0
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
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
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);
}
}

BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.EnvironmentAgent.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.InfluenceEvent.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.PerceptionEvent.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.SimulationAgentReady.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.StartSimulation.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.StopSimulation.java._trace View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.environment.sarlbin View File


BIN
src/main/generated-sources/sarl/fr/utbm/info/vi51/framework/environment/.events.sarlbin View File


+ 428
- 0
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)