mirror of
https://github.com/klmp200/sarl-fireworks.git
synced 2024-11-21 22:33:20 +00:00
Initial commit
This commit is contained in:
commit
efb06147b3
15
.classpath
Normal file
15
.classpath
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/sarl"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="src" path="src/main/generated-sources/sarl">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry exported="true" kind="con" path="io.sarl.eclipse.launching.SARL_SUPPORT"/>
|
||||
<classpathentry kind="con" path="io.janusproject.plugin.launching.JANUS_SUPPORT"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
24
.project
Normal file
24
.project
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>io.sarl.demos.fireworks</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>
|
12
.settings/org.eclipse.jdt.core.prefs
Normal file
12
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class CreateArea extends Event {
|
||||
@SyntheticMember
|
||||
public CreateArea() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public CreateArea(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Exit extends Event {
|
||||
@SyntheticMember
|
||||
public Exit() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public Exit(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Explode extends Event {
|
||||
@SyntheticMember
|
||||
public Explode() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public Explode(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,458 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.core.AgentTask;
|
||||
import io.sarl.core.Behaviors;
|
||||
import io.sarl.core.DefaultContextInteractions;
|
||||
import io.sarl.core.ExternalContextAccess;
|
||||
import io.sarl.core.Initialize;
|
||||
import io.sarl.core.Lifecycle;
|
||||
import io.sarl.core.Logging;
|
||||
import io.sarl.core.Schedules;
|
||||
import io.sarl.core.Time;
|
||||
import io.sarl.demos.fireworks.Exit;
|
||||
import io.sarl.demos.fireworks.FireReady;
|
||||
import io.sarl.demos.fireworks.Freeze;
|
||||
import io.sarl.demos.fireworks.Positions;
|
||||
import io.sarl.demos.fireworks.UpdateFirePosition;
|
||||
import io.sarl.lang.annotation.ImportedCapacityFeature;
|
||||
import io.sarl.lang.annotation.PerceptGuardEvaluator;
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Agent;
|
||||
import io.sarl.lang.core.BuiltinCapacitiesProvider;
|
||||
import io.sarl.lang.core.Skill;
|
||||
import io.sarl.lang.util.ClearableReference;
|
||||
import io.sarl.util.Scopes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
import java.util.function.Consumer;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.xtext.xbase.lib.Conversions;
|
||||
import org.eclipse.xtext.xbase.lib.DoubleExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Inline;
|
||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure2;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Fire extends Agent {
|
||||
private List<Double> x;
|
||||
|
||||
private List<Double> y;
|
||||
|
||||
private int lifetime = 300;
|
||||
|
||||
private boolean frozen = false;
|
||||
|
||||
private boolean destroyed = false;
|
||||
|
||||
private boolean exited = false;
|
||||
|
||||
private Positions grid;
|
||||
|
||||
private Double xf;
|
||||
|
||||
private Double yf;
|
||||
|
||||
private UUID id = UUID.randomUUID();
|
||||
|
||||
private UUID parentID;
|
||||
|
||||
private AgentTask move;
|
||||
|
||||
private UUID parentAgent;
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Freeze$0(final Freeze occurrence) {
|
||||
this.frozen = occurrence.value;
|
||||
if (this.frozen) {
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.cancel(this.move, true);
|
||||
} else {
|
||||
Behaviors _$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER = this.$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
UpdateFirePosition _updateFirePosition = new UpdateFirePosition();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER.wake(_updateFirePosition);
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Initialize$1(final Initialize occurrence) {
|
||||
ArrayList<Double> _arrayList = new ArrayList<Double>();
|
||||
this.x = _arrayList;
|
||||
ArrayList<Double> _arrayList_1 = new ArrayList<Double>();
|
||||
this.y = _arrayList_1;
|
||||
boolean _equals = Integer.valueOf(((List<Object>)Conversions.doWrapArray(occurrence.parameters)).size()).equals(Integer.valueOf(4));
|
||||
if (_equals) {
|
||||
Object _get = occurrence.parameters[0];
|
||||
this.x.add(((Double) _get));
|
||||
Object _get_1 = occurrence.parameters[1];
|
||||
this.y.add(((Double) _get_1));
|
||||
Object _get_2 = occurrence.parameters[2];
|
||||
this.grid = ((Positions) _get_2);
|
||||
Object _get_3 = occurrence.parameters[3];
|
||||
this.parentID = ((UUID) _get_3);
|
||||
} else {
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER.info("Error in fire Initialize : bad parameter number");
|
||||
}
|
||||
this.parentAgent = occurrence.spawner;
|
||||
double _random = Math.random();
|
||||
double _multiply = (_random * 10.0);
|
||||
double _random_1 = Math.random();
|
||||
double _multiply_1 = (_random_1 * 5);
|
||||
double _minus = (_multiply - _multiply_1);
|
||||
this.xf = Double.valueOf(_minus);
|
||||
double _random_2 = Math.random();
|
||||
double _multiply_2 = (_random_2 * 10.0);
|
||||
double _plus = (_multiply_2 + 1.0);
|
||||
this.yf = Double.valueOf(_plus);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$FireReady$2(final FireReady occurrence) {
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
final Procedure1<Agent> _function = (Agent it) -> {
|
||||
try {
|
||||
Behaviors _$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER = this.$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
UpdateFirePosition _updateFirePosition = new UpdateFirePosition();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER.wake(_updateFirePosition);
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof Exception) {
|
||||
final Exception e = (Exception)_t;
|
||||
e.printStackTrace();
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
};
|
||||
this.move = _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.atFixedDelay(30, _function);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$UpdateFirePosition$3(final UpdateFirePosition occurrence) {
|
||||
Double _last = IterableExtensions.<Double>last(this.x);
|
||||
double newx = DoubleExtensions.operator_plus(_last, this.xf);
|
||||
Double _last_1 = IterableExtensions.<Double>last(this.y);
|
||||
double newy = DoubleExtensions.operator_plus(_last_1, this.yf);
|
||||
this.x.add(Double.valueOf(newx));
|
||||
this.y.add(Double.valueOf(newy));
|
||||
if ((this.grid != null)) {
|
||||
ArrayList<Vector<Double>> list = new ArrayList<Vector<Double>>();
|
||||
final Consumer<Double> _function = (Double pos) -> {
|
||||
Vector<Double> nvect = new Vector<Double>(2);
|
||||
nvect.add(pos);
|
||||
list.add(nvect);
|
||||
};
|
||||
this.x.forEach(_function);
|
||||
final Procedure2<Double, Integer> _function_1 = (Double pos, Integer i) -> {
|
||||
Vector<Double> nvect = list.get((i).intValue());
|
||||
nvect.add(pos);
|
||||
list.set((i).intValue(), nvect);
|
||||
};
|
||||
IterableExtensions.<Double>forEach(this.y, _function_1);
|
||||
this.grid.setFirePosition(this.id, this.parentID, list);
|
||||
}
|
||||
this.lifetime = (this.lifetime - 10);
|
||||
if ((this.lifetime <= 0)) {
|
||||
this.grid.removeFirePosition(this.id);
|
||||
this.cleanBeforeExit();
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
final Procedure1<Agent> _function_2 = (Agent it) -> {
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.killMe();
|
||||
};
|
||||
_$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.in(1000, _function_2);
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$UpdateFirePosition$3(final UpdateFirePosition it, final UpdateFirePosition occurrence) {
|
||||
return ((this.isFromMe(occurrence) && (!this.frozen)) && (!this.destroyed));
|
||||
}
|
||||
|
||||
protected boolean cleanBeforeExit() {
|
||||
boolean _xblockexpression = false;
|
||||
{
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.cancel(this.move, true);
|
||||
this.exited = true;
|
||||
_xblockexpression = this.destroyed = true;
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Exit$4(final Exit occurrence) {
|
||||
this.frozen = true;
|
||||
this.cleanBeforeExit();
|
||||
DefaultContextInteractions _$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER = this.$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
Exit _exit = new Exit();
|
||||
DefaultContextInteractions _$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER_1 = this.$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER.emit(_exit, Scopes.addresses(_$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER_1.getDefaultSpace().getAddress(this.parentAgent)));
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.killMe();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Exit$4(final Exit it, final Exit occurrence) {
|
||||
return ((!this.exited) && it.isFrom(this.getParentID()));
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Lifecycle.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE)", imported = Lifecycle.class)
|
||||
private Lifecycle $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class);
|
||||
}
|
||||
return $castSkill(Lifecycle.class, this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Logging.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LOGGING;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING)", imported = Logging.class)
|
||||
private Logging $CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class);
|
||||
}
|
||||
return $castSkill(Logging.class, this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Behaviors.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS)", imported = Behaviors.class)
|
||||
private Behaviors $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class);
|
||||
}
|
||||
return $castSkill(Behaviors.class, this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(DefaultContextInteractions.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS)", imported = DefaultContextInteractions.class)
|
||||
private DefaultContextInteractions $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class);
|
||||
}
|
||||
return $castSkill(DefaultContextInteractions.class, this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(ExternalContextAccess.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(ExternalContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS)", imported = ExternalContextAccess.class)
|
||||
private ExternalContextAccess $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class);
|
||||
}
|
||||
return $castSkill(ExternalContextAccess.class, this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Schedules.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_SCHEDULES;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES)", imported = Schedules.class)
|
||||
private Schedules $CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class);
|
||||
}
|
||||
return $castSkill(Schedules.class, this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Time.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_TIME;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Time.class, (this.$CAPACITY_USE$IO_SARL_CORE_TIME == null || this.$CAPACITY_USE$IO_SARL_CORE_TIME.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_TIME = $getSkill(Time.class)) : this.$CAPACITY_USE$IO_SARL_CORE_TIME)", imported = Time.class)
|
||||
private Time $CAPACITY_USE$IO_SARL_CORE_TIME$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_TIME == null || this.$CAPACITY_USE$IO_SARL_CORE_TIME.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_TIME = $getSkill(Time.class);
|
||||
}
|
||||
return $castSkill(Time.class, this.$CAPACITY_USE$IO_SARL_CORE_TIME);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Initialize(final Initialize occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Initialize$1(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$FireReady(final FireReady occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$FireReady$2(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Freeze(final Freeze occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Freeze$0(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Exit(final Exit occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Exit$4(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Exit$4(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$UpdateFirePosition(final UpdateFirePosition occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$UpdateFirePosition$3(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$UpdateFirePosition$3(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Fire other = (Fire) obj;
|
||||
if (this.x == null) {
|
||||
if (other.x != null)
|
||||
return false;
|
||||
} else if (!this.x.equals(other.x))
|
||||
return false;
|
||||
if (this.y == null) {
|
||||
if (other.y != null)
|
||||
return false;
|
||||
} else if (!this.y.equals(other.y))
|
||||
return false;
|
||||
if (other.lifetime != this.lifetime)
|
||||
return false;
|
||||
if (other.frozen != this.frozen)
|
||||
return false;
|
||||
if (other.destroyed != this.destroyed)
|
||||
return false;
|
||||
if (other.exited != this.exited)
|
||||
return false;
|
||||
if (this.grid == null) {
|
||||
if (other.grid != null)
|
||||
return false;
|
||||
} else if (!this.grid.equals(other.grid))
|
||||
return false;
|
||||
if (this.xf == null) {
|
||||
if (other.xf != null)
|
||||
return false;
|
||||
} else if (!this.xf.equals(other.xf))
|
||||
return false;
|
||||
if (this.yf == null) {
|
||||
if (other.yf != null)
|
||||
return false;
|
||||
} else if (!this.yf.equals(other.yf))
|
||||
return false;
|
||||
if (this.id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!this.id.equals(other.id))
|
||||
return false;
|
||||
if (this.parentID == null) {
|
||||
if (other.parentID != null)
|
||||
return false;
|
||||
} else if (!this.parentID.equals(other.parentID))
|
||||
return false;
|
||||
if (this.move == null) {
|
||||
if (other.move != null)
|
||||
return false;
|
||||
} else if (!this.move.equals(other.move))
|
||||
return false;
|
||||
if (this.parentAgent == null) {
|
||||
if (other.parentAgent != null)
|
||||
return false;
|
||||
} else if (!this.parentAgent.equals(other.parentAgent))
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.x== null) ? 0 : this.x.hashCode());
|
||||
result = prime * result + ((this.y== null) ? 0 : this.y.hashCode());
|
||||
result = prime * result + this.lifetime;
|
||||
result = prime * result + (this.frozen ? 1231 : 1237);
|
||||
result = prime * result + (this.destroyed ? 1231 : 1237);
|
||||
result = prime * result + (this.exited ? 1231 : 1237);
|
||||
result = prime * result + ((this.grid== null) ? 0 : this.grid.hashCode());
|
||||
result = prime * result + ((this.xf== null) ? 0 : this.xf.hashCode());
|
||||
result = prime * result + ((this.yf== null) ? 0 : this.yf.hashCode());
|
||||
result = prime * result + ((this.id== null) ? 0 : this.id.hashCode());
|
||||
result = prime * result + ((this.parentID== null) ? 0 : this.parentID.hashCode());
|
||||
result = prime * result + ((this.move== null) ? 0 : this.move.hashCode());
|
||||
result = prime * result + ((this.parentAgent== null) ? 0 : this.parentAgent.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public Fire(final UUID parentID, final UUID agentID) {
|
||||
super(parentID, agentID);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Inject
|
||||
public Fire(final BuiltinCapacitiesProvider provider, final UUID parentID, final UUID agentID) {
|
||||
super(provider, parentID, agentID);
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import javafx.scene.paint.Color;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class FirePos {
|
||||
public final int FIREREFRESHDELAY = 100;
|
||||
|
||||
private List<Vector<Double>> positions;
|
||||
|
||||
private Color color;
|
||||
|
||||
@Pure
|
||||
public List<Vector<Double>> getPositions() {
|
||||
return this.positions;
|
||||
}
|
||||
|
||||
public List<Vector<Double>> setPositions(final List<Vector<Double>> positions) {
|
||||
return this.positions = positions;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Color getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public Color setColor(final Color color) {
|
||||
return this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
FirePos other = (FirePos) obj;
|
||||
if (other.FIREREFRESHDELAY != this.FIREREFRESHDELAY)
|
||||
return false;
|
||||
if (this.positions == null) {
|
||||
if (other.positions != null)
|
||||
return false;
|
||||
} else if (!this.positions.equals(other.positions))
|
||||
return false;
|
||||
if (this.color == null) {
|
||||
if (other.color != null)
|
||||
return false;
|
||||
} else if (!this.color.equals(other.color))
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + this.FIREREFRESHDELAY;
|
||||
result = prime * result + ((this.positions== null) ? 0 : this.positions.hashCode());
|
||||
result = prime * result + ((this.color== null) ? 0 : this.color.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public FirePos() {
|
||||
super();
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class FireReady extends Event {
|
||||
@SyntheticMember
|
||||
public FireReady() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public FireReady(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.janusproject.Boot;
|
||||
import io.janusproject.kernel.Kernel;
|
||||
import io.sarl.demos.fireworks.FXMLViewerController;
|
||||
import io.sarl.demos.fireworks.LaunchingArea;
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Firework {
|
||||
public static Kernel main(final FXMLViewerController controller) {
|
||||
try {
|
||||
Kernel _xblockexpression = null;
|
||||
{
|
||||
Boot.setOffline(true);
|
||||
_xblockexpression = Boot.startJanus(LaunchingArea.class, controller);
|
||||
}
|
||||
return _xblockexpression;
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public Firework() {
|
||||
super();
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Event;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Freeze extends Event {
|
||||
public boolean value;
|
||||
|
||||
public Freeze(final boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Freeze other = (Freeze) obj;
|
||||
if (other.value != this.value)
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + (this.value ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of the Freeze event's attributes only.
|
||||
*/
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
protected String attributesToString() {
|
||||
StringBuilder result = new StringBuilder(super.attributesToString());
|
||||
result.append("value = ").append(this.value);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 2771119382L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class KillFire extends Event {
|
||||
@SyntheticMember
|
||||
public KillFire() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public KillFire(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class KillRocket extends Event {
|
||||
@SyntheticMember
|
||||
public KillRocket() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public KillRocket(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Launch extends Event {
|
||||
@SyntheticMember
|
||||
public Launch() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public Launch(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,391 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.core.Behaviors;
|
||||
import io.sarl.core.DefaultContextInteractions;
|
||||
import io.sarl.core.ExternalContextAccess;
|
||||
import io.sarl.core.Initialize;
|
||||
import io.sarl.core.InnerContextAccess;
|
||||
import io.sarl.core.Lifecycle;
|
||||
import io.sarl.core.Logging;
|
||||
import io.sarl.core.MemberJoined;
|
||||
import io.sarl.demos.fireworks.CreateArea;
|
||||
import io.sarl.demos.fireworks.Exit;
|
||||
import io.sarl.demos.fireworks.FXMLViewerController;
|
||||
import io.sarl.demos.fireworks.Freeze;
|
||||
import io.sarl.demos.fireworks.Launch;
|
||||
import io.sarl.demos.fireworks.Positions;
|
||||
import io.sarl.demos.fireworks.RocketLauncher;
|
||||
import io.sarl.demos.fireworks.SetupSettings;
|
||||
import io.sarl.lang.annotation.ImportedCapacityFeature;
|
||||
import io.sarl.lang.annotation.PerceptGuardEvaluator;
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Agent;
|
||||
import io.sarl.lang.core.BuiltinCapacitiesProvider;
|
||||
import io.sarl.lang.core.Skill;
|
||||
import io.sarl.lang.util.ClearableReference;
|
||||
import io.sarl.util.OpenEventSpace;
|
||||
import io.sarl.util.OpenEventSpaceSpecification;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.xtext.xbase.lib.Conversions;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Inline;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class LaunchingArea extends Agent {
|
||||
private Integer rocketsQuantity;
|
||||
|
||||
private Integer fireQuantity;
|
||||
|
||||
private Double gravity;
|
||||
|
||||
private Positions grid = new Positions();
|
||||
|
||||
private double maxWidth = 10.0;
|
||||
|
||||
private boolean exited = false;
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$SetupSettings$0(final SetupSettings occurrence) {
|
||||
this.rocketsQuantity = occurrence.rocketsQuantity;
|
||||
this.fireQuantity = occurrence.fireQuatity;
|
||||
this.gravity = occurrence.gravity;
|
||||
this.maxWidth = (occurrence.maxWidth).doubleValue();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Exit$1(final Exit occurrence) {
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.killMe();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Exit$1(final Exit it, final Exit occurrence) {
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
boolean _hasMemberAgent = _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.hasMemberAgent();
|
||||
boolean _not = (!_hasMemberAgent);
|
||||
return _not;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Exit$2(final Exit occurrence) {
|
||||
this.exited = true;
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
Exit _exit = new Exit();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext().getDefaultSpace().emit(_exit, null);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Exit$2(final Exit it, final Exit occurrence) {
|
||||
return (this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).hasMemberAgent() && (!this.exited));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Initialize$3(final Initialize occurrence) {
|
||||
this.rocketsQuantity = Integer.valueOf(20);
|
||||
this.fireQuantity = Integer.valueOf(30);
|
||||
this.gravity = Double.valueOf(0.5);
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER.info("Setup Area");
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Initialize$3(final Initialize it, final Initialize occurrence) {
|
||||
boolean _isEmpty = ((List<Object>)Conversions.doWrapArray(occurrence.parameters)).isEmpty();
|
||||
return _isEmpty;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Initialize$4(final Initialize occurrence) {
|
||||
Object _get = occurrence.parameters[0];
|
||||
FXMLViewerController ctrl = ((FXMLViewerController) _get);
|
||||
DefaultContextInteractions _$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER = this.$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
OpenEventSpace space = _$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER.getDefaultContext().<OpenEventSpace>createSpace(OpenEventSpaceSpecification.class, UUID.randomUUID());
|
||||
ctrl.setGUISpace(space);
|
||||
Behaviors _$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER = this.$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
space.register(_$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER.asEventListener());
|
||||
ctrl.listenAndDraw(this.grid);
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER.info("Setup Area");
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Initialize$4(final Initialize it, final Initialize occurrence) {
|
||||
boolean _isEmpty = ((List<Object>)Conversions.doWrapArray(occurrence.parameters)).isEmpty();
|
||||
boolean _not = (!_isEmpty);
|
||||
return _not;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$CreateArea$5(final CreateArea occurrence) {
|
||||
Double x = null;
|
||||
int i = 0;
|
||||
Random rnd = new Random();
|
||||
while ((i < (this.rocketsQuantity).intValue())) {
|
||||
{
|
||||
double _nextDouble = rnd.nextDouble();
|
||||
double _multiply = (_nextDouble * this.maxWidth);
|
||||
x = Double.valueOf(_multiply);
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.spawnInContext(RocketLauncher.class, _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext(), x, Double.valueOf(0.0), this.fireQuantity, this.gravity, this.grid);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Freeze$6(final Freeze occurrence) {
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext().getDefaultSpace().emit(occurrence, null);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Freeze$6(final Freeze it, final Freeze occurrence) {
|
||||
boolean _isFromMe = this.isFromMe(occurrence);
|
||||
boolean _not = (!_isFromMe);
|
||||
return _not;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$MemberJoined$7(final MemberJoined occurrence) {
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER.info("Area Ready");
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
Launch _launch = new Launch();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext().getDefaultSpace().emit(_launch, null);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$MemberJoined$7(final MemberJoined it, final MemberJoined occurrence) {
|
||||
return (this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).isInInnerDefaultSpace(occurrence) && (this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).getMemberAgentCount() == (this.rocketsQuantity).intValue()));
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(DefaultContextInteractions.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS)", imported = DefaultContextInteractions.class)
|
||||
private DefaultContextInteractions $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class);
|
||||
}
|
||||
return $castSkill(DefaultContextInteractions.class, this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Lifecycle.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE)", imported = Lifecycle.class)
|
||||
private Lifecycle $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class);
|
||||
}
|
||||
return $castSkill(Lifecycle.class, this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Behaviors.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS)", imported = Behaviors.class)
|
||||
private Behaviors $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class);
|
||||
}
|
||||
return $castSkill(Behaviors.class, this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Logging.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LOGGING;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING)", imported = Logging.class)
|
||||
private Logging $CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class);
|
||||
}
|
||||
return $castSkill(Logging.class, this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(InnerContextAccess.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS)", imported = InnerContextAccess.class)
|
||||
private InnerContextAccess $CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class);
|
||||
}
|
||||
return $castSkill(InnerContextAccess.class, this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(ExternalContextAccess.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(ExternalContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS)", imported = ExternalContextAccess.class)
|
||||
private ExternalContextAccess $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class);
|
||||
}
|
||||
return $castSkill(ExternalContextAccess.class, this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Initialize(final Initialize occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Initialize$3(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Initialize$3(occurrence));
|
||||
}
|
||||
if ($behaviorUnitGuard$Initialize$4(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Initialize$4(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$SetupSettings(final SetupSettings occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$SetupSettings$0(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Freeze(final Freeze occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Freeze$6(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Freeze$6(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Exit(final Exit occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Exit$1(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Exit$1(occurrence));
|
||||
}
|
||||
if ($behaviorUnitGuard$Exit$2(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Exit$2(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$CreateArea(final CreateArea occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$CreateArea$5(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$MemberJoined(final MemberJoined occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$MemberJoined$7(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$MemberJoined$7(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LaunchingArea other = (LaunchingArea) obj;
|
||||
if (this.rocketsQuantity == null) {
|
||||
if (other.rocketsQuantity != null)
|
||||
return false;
|
||||
} else if (!this.rocketsQuantity.equals(other.rocketsQuantity))
|
||||
return false;
|
||||
if (this.fireQuantity == null) {
|
||||
if (other.fireQuantity != null)
|
||||
return false;
|
||||
} else if (!this.fireQuantity.equals(other.fireQuantity))
|
||||
return false;
|
||||
if (this.gravity == null) {
|
||||
if (other.gravity != null)
|
||||
return false;
|
||||
} else if (!this.gravity.equals(other.gravity))
|
||||
return false;
|
||||
if (this.grid == null) {
|
||||
if (other.grid != null)
|
||||
return false;
|
||||
} else if (!this.grid.equals(other.grid))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(other.maxWidth) != Double.doubleToLongBits(this.maxWidth))
|
||||
return false;
|
||||
if (other.exited != this.exited)
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.rocketsQuantity== null) ? 0 : this.rocketsQuantity.hashCode());
|
||||
result = prime * result + ((this.fireQuantity== null) ? 0 : this.fireQuantity.hashCode());
|
||||
result = prime * result + ((this.gravity== null) ? 0 : this.gravity.hashCode());
|
||||
result = prime * result + ((this.grid== null) ? 0 : this.grid.hashCode());
|
||||
result = prime * result + (int) (Double.doubleToLongBits(this.maxWidth) ^ (Double.doubleToLongBits(this.maxWidth) >>> 32));
|
||||
result = prime * result + (this.exited ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public LaunchingArea(final UUID parentID, final UUID agentID) {
|
||||
super(parentID, agentID);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Inject
|
||||
public LaunchingArea(final BuiltinCapacitiesProvider provider, final UUID parentID, final UUID agentID) {
|
||||
super(provider, parentID, agentID);
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.demos.fireworks.FirePos;
|
||||
import io.sarl.demos.fireworks.RocketsPos;
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
import javafx.scene.paint.Color;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Positions {
|
||||
private HashMap<UUID, RocketsPos> rockets = new HashMap<UUID, RocketsPos>();
|
||||
|
||||
private HashMap<UUID, FirePos> fire = new HashMap<UUID, FirePos>();
|
||||
|
||||
@Pure
|
||||
public Map<UUID, RocketsPos> getRockets() {
|
||||
return Collections.<UUID, RocketsPos>unmodifiableMap(this.rockets);
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Map<UUID, FirePos> getFire() {
|
||||
return Collections.<UUID, FirePos>unmodifiableMap(this.fire);
|
||||
}
|
||||
|
||||
public RocketsPos setRocketPosition(final UUID id, final Vector<Double> position) {
|
||||
RocketsPos _xblockexpression = null;
|
||||
{
|
||||
RocketsPos pos = new RocketsPos();
|
||||
pos.setPosition(position);
|
||||
RocketsPos _xifexpression = null;
|
||||
boolean _containsKey = this.rockets.containsKey(id);
|
||||
if (_containsKey) {
|
||||
RocketsPos _xblockexpression_1 = null;
|
||||
{
|
||||
pos.setColor(this.rockets.get(id).getColor());
|
||||
_xblockexpression_1 = this.rockets.replace(id, pos);
|
||||
}
|
||||
_xifexpression = _xblockexpression_1;
|
||||
} else {
|
||||
RocketsPos _xblockexpression_2 = null;
|
||||
{
|
||||
pos.setColor(Color.color(Math.random(), Math.random(), Math.random()));
|
||||
_xblockexpression_2 = this.rockets.put(id, pos);
|
||||
}
|
||||
_xifexpression = _xblockexpression_2;
|
||||
}
|
||||
_xblockexpression = _xifexpression;
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
|
||||
public RocketsPos removeRocketPosition(final UUID id) {
|
||||
return this.rockets.remove(id);
|
||||
}
|
||||
|
||||
public boolean hideHocketPosition(final UUID id) {
|
||||
return this.rockets.get(id).setHidden(true);
|
||||
}
|
||||
|
||||
public FirePos setFirePosition(final UUID id, final UUID rocketID, final List<Vector<Double>> positions) {
|
||||
FirePos _xblockexpression = null;
|
||||
{
|
||||
FirePos pos = new FirePos();
|
||||
pos.setPositions(positions);
|
||||
FirePos _xifexpression = null;
|
||||
boolean _containsKey = this.fire.containsKey(id);
|
||||
if (_containsKey) {
|
||||
FirePos _xblockexpression_1 = null;
|
||||
{
|
||||
pos.setColor(this.fire.get(id).getColor());
|
||||
_xblockexpression_1 = this.fire.replace(id, pos);
|
||||
}
|
||||
_xifexpression = _xblockexpression_1;
|
||||
} else {
|
||||
FirePos _xblockexpression_2 = null;
|
||||
{
|
||||
boolean _containsKey_1 = this.rockets.containsKey(rocketID);
|
||||
if (_containsKey_1) {
|
||||
pos.setColor(this.rockets.get(rocketID).getColor());
|
||||
} else {
|
||||
pos.setColor(Color.color(Math.random(), Math.random(), Math.random()));
|
||||
}
|
||||
_xblockexpression_2 = this.fire.put(id, pos);
|
||||
}
|
||||
_xifexpression = _xblockexpression_2;
|
||||
}
|
||||
_xblockexpression = _xifexpression;
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
|
||||
public FirePos removeFirePosition(final UUID id) {
|
||||
return this.fire.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Positions other = (Positions) obj;
|
||||
if (this.rockets == null) {
|
||||
if (other.rockets != null)
|
||||
return false;
|
||||
} else if (!this.rockets.equals(other.rockets))
|
||||
return false;
|
||||
if (this.fire == null) {
|
||||
if (other.fire != null)
|
||||
return false;
|
||||
} else if (!this.fire.equals(other.fire))
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.rockets== null) ? 0 : this.rockets.hashCode());
|
||||
result = prime * result + ((this.fire== null) ? 0 : this.fire.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public Positions() {
|
||||
super();
|
||||
}
|
||||
}
|
@ -0,0 +1,511 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.core.AgentTask;
|
||||
import io.sarl.core.Behaviors;
|
||||
import io.sarl.core.DefaultContextInteractions;
|
||||
import io.sarl.core.ExternalContextAccess;
|
||||
import io.sarl.core.Initialize;
|
||||
import io.sarl.core.InnerContextAccess;
|
||||
import io.sarl.core.Lifecycle;
|
||||
import io.sarl.core.Logging;
|
||||
import io.sarl.core.MemberJoined;
|
||||
import io.sarl.core.MemberLeft;
|
||||
import io.sarl.core.Schedules;
|
||||
import io.sarl.demos.fireworks.Exit;
|
||||
import io.sarl.demos.fireworks.Explode;
|
||||
import io.sarl.demos.fireworks.Fire;
|
||||
import io.sarl.demos.fireworks.FireReady;
|
||||
import io.sarl.demos.fireworks.Freeze;
|
||||
import io.sarl.demos.fireworks.Positions;
|
||||
import io.sarl.demos.fireworks.UpdateRocketPosition;
|
||||
import io.sarl.lang.annotation.ImportedCapacityFeature;
|
||||
import io.sarl.lang.annotation.PerceptGuardEvaluator;
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Agent;
|
||||
import io.sarl.lang.core.BuiltinCapacitiesProvider;
|
||||
import io.sarl.lang.core.Skill;
|
||||
import io.sarl.lang.util.ClearableReference;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.xtext.xbase.lib.Conversions;
|
||||
import org.eclipse.xtext.xbase.lib.DoubleExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Inline;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class Rocket extends Agent {
|
||||
private Double x;
|
||||
|
||||
private Double y;
|
||||
|
||||
private Double gravity;
|
||||
|
||||
private Double speedx;
|
||||
|
||||
private Double speedy;
|
||||
|
||||
private Integer fireQuantity;
|
||||
|
||||
private Integer lifetime;
|
||||
|
||||
private boolean frozen = false;
|
||||
|
||||
private boolean exploded = false;
|
||||
|
||||
private boolean exited = false;
|
||||
|
||||
private Positions grid;
|
||||
|
||||
private UUID id;
|
||||
|
||||
private AgentTask move;
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Exit$0(final Exit occurrence) {
|
||||
DefaultContextInteractions _$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER = this.$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
Exit _exit = new Exit();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER.emit(_exit);
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.killMe();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Exit$0(final Exit it, final Exit occurrence) {
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
boolean _hasMemberAgent = _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.hasMemberAgent();
|
||||
boolean _not = (!_hasMemberAgent);
|
||||
return _not;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Exit$1(final Exit occurrence) {
|
||||
this.exploded = true;
|
||||
this.frozen = true;
|
||||
this.exited = true;
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.cancel(this.move, true);
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
Exit _exit = new Exit();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext().getDefaultSpace().emit(_exit, null);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Exit$1(final Exit it, final Exit occurrence) {
|
||||
return (this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).hasMemberAgent() && (!this.exited));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Freeze$2(final Freeze occurrence) {
|
||||
this.frozen = occurrence.value;
|
||||
if (this.frozen) {
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.cancel(this.move, true);
|
||||
}
|
||||
if ((!this.frozen)) {
|
||||
Behaviors _$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER = this.$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
UpdateRocketPosition _updateRocketPosition = new UpdateRocketPosition();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER.wake(_updateRocketPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Initialize$3(final Initialize occurrence) {
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER.info("New rocket launched");
|
||||
Random rnd = new Random();
|
||||
boolean _equals = Integer.valueOf(((List<Object>)Conversions.doWrapArray(occurrence.parameters)).size()).equals(Integer.valueOf(7));
|
||||
if (_equals) {
|
||||
Object _get = occurrence.parameters[0];
|
||||
this.x = ((Double) _get);
|
||||
Object _get_1 = occurrence.parameters[1];
|
||||
this.y = ((Double) _get_1);
|
||||
Object _get_2 = occurrence.parameters[2];
|
||||
this.speedx = ((Double) _get_2);
|
||||
Object _get_3 = occurrence.parameters[3];
|
||||
this.speedy = ((Double) _get_3);
|
||||
Object _get_4 = occurrence.parameters[4];
|
||||
this.gravity = ((Double) _get_4);
|
||||
Object _get_5 = occurrence.parameters[5];
|
||||
this.fireQuantity = ((Integer) _get_5);
|
||||
Object _get_6 = occurrence.parameters[6];
|
||||
this.grid = ((Positions) _get_6);
|
||||
} else {
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER_1 = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER_1.info("Error in Fireworks Initialize : bad parameters number");
|
||||
}
|
||||
int _nextInt = rnd.nextInt(5);
|
||||
int _multiply = (_nextInt * 300);
|
||||
int _plus = (_multiply + 300);
|
||||
this.lifetime = Integer.valueOf(_plus);
|
||||
this.id = UUID.randomUUID();
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
final Procedure1<Agent> _function = (Agent it) -> {
|
||||
try {
|
||||
Behaviors _$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER = this.$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
UpdateRocketPosition _updateRocketPosition = new UpdateRocketPosition();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER.wake(_updateRocketPosition);
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof Exception) {
|
||||
final Exception e = (Exception)_t;
|
||||
e.printStackTrace();
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
};
|
||||
this.move = _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.atFixedDelay(30, _function);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$UpdateRocketPosition$4(final UpdateRocketPosition occurrence) {
|
||||
Vector<Double> vect = new Vector<Double>(2);
|
||||
double _plus = DoubleExtensions.operator_plus(this.x, this.speedx);
|
||||
this.x = Double.valueOf(_plus);
|
||||
double _plus_1 = DoubleExtensions.operator_plus(this.y, this.speedy);
|
||||
this.y = Double.valueOf(_plus_1);
|
||||
vect.clear();
|
||||
vect.add(this.x);
|
||||
vect.add(this.y);
|
||||
this.lifetime = Integer.valueOf(((this.lifetime).intValue() - 10));
|
||||
if ((this.grid != null)) {
|
||||
this.grid.setRocketPosition(this.id, vect);
|
||||
}
|
||||
if (((this.lifetime).intValue() <= 0)) {
|
||||
this.exploded = true;
|
||||
Schedules _$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER = this.$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER.cancel(this.move, true);
|
||||
this.grid.hideHocketPosition(this.id);
|
||||
Behaviors _$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER = this.$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
Explode _explode = new Explode();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER.wake(_explode);
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$UpdateRocketPosition$4(final UpdateRocketPosition it, final UpdateRocketPosition occurrence) {
|
||||
return ((this.isFromMe(occurrence) && (!this.frozen)) && (!this.exploded));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Explode$5(final Explode occurrence) {
|
||||
for (int i = 0; (i < (this.fireQuantity).intValue()); i++) {
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.spawnInContext(Fire.class, _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext(), this.x, this.y, this.grid, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$MemberLeft$6(final MemberLeft occurrence) {
|
||||
this.exited = true;
|
||||
this.grid.removeRocketPosition(this.id);
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.killMe();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$MemberLeft$6(final MemberLeft it, final MemberLeft occurrence) {
|
||||
return (((!this.isFromMe(occurrence)) && (!this.frozen)) && (!this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).hasMemberAgent()));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$MemberJoined$7(final MemberJoined occurrence) {
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
FireReady _fireReady = new FireReady();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext().getDefaultSpace().emit(_fireReady, null);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$MemberJoined$7(final MemberJoined it, final MemberJoined occurrence) {
|
||||
return (((!this.isFromMe(occurrence)) && this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).hasMemberAgent()) && (this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).getMemberAgentCount() == (this.fireQuantity).intValue()));
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Lifecycle.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE)", imported = Lifecycle.class)
|
||||
private Lifecycle $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class);
|
||||
}
|
||||
return $castSkill(Lifecycle.class, this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Logging.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LOGGING;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING)", imported = Logging.class)
|
||||
private Logging $CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class);
|
||||
}
|
||||
return $castSkill(Logging.class, this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Schedules.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_SCHEDULES;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Schedules.class, (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class)) : this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES)", imported = Schedules.class)
|
||||
private Schedules $CAPACITY_USE$IO_SARL_CORE_SCHEDULES$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES == null || this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES = $getSkill(Schedules.class);
|
||||
}
|
||||
return $castSkill(Schedules.class, this.$CAPACITY_USE$IO_SARL_CORE_SCHEDULES);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Behaviors.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS)", imported = Behaviors.class)
|
||||
private Behaviors $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class);
|
||||
}
|
||||
return $castSkill(Behaviors.class, this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(DefaultContextInteractions.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS)", imported = DefaultContextInteractions.class)
|
||||
private DefaultContextInteractions $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class);
|
||||
}
|
||||
return $castSkill(DefaultContextInteractions.class, this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(InnerContextAccess.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS)", imported = InnerContextAccess.class)
|
||||
private InnerContextAccess $CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class);
|
||||
}
|
||||
return $castSkill(InnerContextAccess.class, this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(ExternalContextAccess.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(ExternalContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS)", imported = ExternalContextAccess.class)
|
||||
private ExternalContextAccess $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class);
|
||||
}
|
||||
return $castSkill(ExternalContextAccess.class, this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Initialize(final Initialize occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Initialize$3(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$UpdateRocketPosition(final UpdateRocketPosition occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$UpdateRocketPosition$4(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$UpdateRocketPosition$4(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Freeze(final Freeze occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Freeze$2(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$MemberLeft(final MemberLeft occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$MemberLeft$6(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$MemberLeft$6(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Explode(final Explode occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Explode$5(occurrence));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Exit(final Exit occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Exit$0(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Exit$0(occurrence));
|
||||
}
|
||||
if ($behaviorUnitGuard$Exit$1(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Exit$1(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$MemberJoined(final MemberJoined occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$MemberJoined$7(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$MemberJoined$7(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Rocket other = (Rocket) obj;
|
||||
if (this.x == null) {
|
||||
if (other.x != null)
|
||||
return false;
|
||||
} else if (!this.x.equals(other.x))
|
||||
return false;
|
||||
if (this.y == null) {
|
||||
if (other.y != null)
|
||||
return false;
|
||||
} else if (!this.y.equals(other.y))
|
||||
return false;
|
||||
if (this.gravity == null) {
|
||||
if (other.gravity != null)
|
||||
return false;
|
||||
} else if (!this.gravity.equals(other.gravity))
|
||||
return false;
|
||||
if (this.speedx == null) {
|
||||
if (other.speedx != null)
|
||||
return false;
|
||||
} else if (!this.speedx.equals(other.speedx))
|
||||
return false;
|
||||
if (this.speedy == null) {
|
||||
if (other.speedy != null)
|
||||
return false;
|
||||
} else if (!this.speedy.equals(other.speedy))
|
||||
return false;
|
||||
if (this.fireQuantity == null) {
|
||||
if (other.fireQuantity != null)
|
||||
return false;
|
||||
} else if (!this.fireQuantity.equals(other.fireQuantity))
|
||||
return false;
|
||||
if (this.lifetime == null) {
|
||||
if (other.lifetime != null)
|
||||
return false;
|
||||
} else if (!this.lifetime.equals(other.lifetime))
|
||||
return false;
|
||||
if (other.frozen != this.frozen)
|
||||
return false;
|
||||
if (other.exploded != this.exploded)
|
||||
return false;
|
||||
if (other.exited != this.exited)
|
||||
return false;
|
||||
if (this.grid == null) {
|
||||
if (other.grid != null)
|
||||
return false;
|
||||
} else if (!this.grid.equals(other.grid))
|
||||
return false;
|
||||
if (this.id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!this.id.equals(other.id))
|
||||
return false;
|
||||
if (this.move == null) {
|
||||
if (other.move != null)
|
||||
return false;
|
||||
} else if (!this.move.equals(other.move))
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.x== null) ? 0 : this.x.hashCode());
|
||||
result = prime * result + ((this.y== null) ? 0 : this.y.hashCode());
|
||||
result = prime * result + ((this.gravity== null) ? 0 : this.gravity.hashCode());
|
||||
result = prime * result + ((this.speedx== null) ? 0 : this.speedx.hashCode());
|
||||
result = prime * result + ((this.speedy== null) ? 0 : this.speedy.hashCode());
|
||||
result = prime * result + ((this.fireQuantity== null) ? 0 : this.fireQuantity.hashCode());
|
||||
result = prime * result + ((this.lifetime== null) ? 0 : this.lifetime.hashCode());
|
||||
result = prime * result + (this.frozen ? 1231 : 1237);
|
||||
result = prime * result + (this.exploded ? 1231 : 1237);
|
||||
result = prime * result + (this.exited ? 1231 : 1237);
|
||||
result = prime * result + ((this.grid== null) ? 0 : this.grid.hashCode());
|
||||
result = prime * result + ((this.id== null) ? 0 : this.id.hashCode());
|
||||
result = prime * result + ((this.move== null) ? 0 : this.move.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public Rocket(final UUID parentID, final UUID agentID) {
|
||||
super(parentID, agentID);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Inject
|
||||
public Rocket(final BuiltinCapacitiesProvider provider, final UUID parentID, final UUID agentID) {
|
||||
super(provider, parentID, agentID);
|
||||
}
|
||||
}
|
@ -0,0 +1,375 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.core.Behaviors;
|
||||
import io.sarl.core.DefaultContextInteractions;
|
||||
import io.sarl.core.ExternalContextAccess;
|
||||
import io.sarl.core.Initialize;
|
||||
import io.sarl.core.InnerContextAccess;
|
||||
import io.sarl.core.Lifecycle;
|
||||
import io.sarl.core.Logging;
|
||||
import io.sarl.core.MemberLeft;
|
||||
import io.sarl.demos.fireworks.Exit;
|
||||
import io.sarl.demos.fireworks.Freeze;
|
||||
import io.sarl.demos.fireworks.Launch;
|
||||
import io.sarl.demos.fireworks.Positions;
|
||||
import io.sarl.demos.fireworks.Rocket;
|
||||
import io.sarl.demos.fireworks.RocketReady;
|
||||
import io.sarl.lang.annotation.ImportedCapacityFeature;
|
||||
import io.sarl.lang.annotation.PerceptGuardEvaluator;
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Agent;
|
||||
import io.sarl.lang.core.BuiltinCapacitiesProvider;
|
||||
import io.sarl.lang.core.Skill;
|
||||
import io.sarl.lang.util.ClearableReference;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.xtext.xbase.lib.Conversions;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Inline;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class RocketLauncher extends Agent {
|
||||
private Double x;
|
||||
|
||||
private Double y;
|
||||
|
||||
private Integer fireQuantity;
|
||||
|
||||
private Double gravity;
|
||||
|
||||
private Positions grid;
|
||||
|
||||
private boolean exited = false;
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Exit$0(final Exit occurrence) {
|
||||
DefaultContextInteractions _$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER = this.$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
Exit _exit = new Exit();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER.emit(_exit);
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.killMe();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Exit$0(final Exit it, final Exit occurrence) {
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
boolean _hasMemberAgent = _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.hasMemberAgent();
|
||||
boolean _not = (!_hasMemberAgent);
|
||||
return _not;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Exit$1(final Exit occurrence) {
|
||||
this.exited = true;
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
Exit _exit = new Exit();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext().getDefaultSpace().emit(_exit, null);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Exit$1(final Exit it, final Exit occurrence) {
|
||||
return (this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS).hasMemberAgent() && (!this.exited));
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Initialize$2(final Initialize occurrence) {
|
||||
Object _get = occurrence.parameters[0];
|
||||
this.x = ((Double) _get);
|
||||
Object _get_1 = occurrence.parameters[1];
|
||||
this.y = ((Double) _get_1);
|
||||
Object _get_2 = occurrence.parameters[2];
|
||||
this.fireQuantity = ((Integer) _get_2);
|
||||
Object _get_3 = occurrence.parameters[3];
|
||||
this.gravity = ((Double) _get_3);
|
||||
Object _get_4 = occurrence.parameters[4];
|
||||
this.grid = ((Positions) _get_4);
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER.info("New rocket launcher created");
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Initialize$2(final Initialize it, final Initialize occurrence) {
|
||||
boolean _isEmpty = ((List<Object>)Conversions.doWrapArray(occurrence.parameters)).isEmpty();
|
||||
boolean _not = (!_isEmpty);
|
||||
return _not;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Initialize$3(final Initialize occurrence) {
|
||||
this.x = Double.valueOf(0.0);
|
||||
this.y = Double.valueOf(0.0);
|
||||
this.fireQuantity = Integer.valueOf(30);
|
||||
this.gravity = Double.valueOf(0.5);
|
||||
this.grid = null;
|
||||
Logging _$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER = this.$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER.info("New rocket launcher created");
|
||||
DefaultContextInteractions _$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER = this.$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
RocketReady _rocketReady = new RocketReady();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER.emit(_rocketReady);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Initialize$3(final Initialize it, final Initialize occurrence) {
|
||||
boolean _isEmpty = ((List<Object>)Conversions.doWrapArray(occurrence.parameters)).isEmpty();
|
||||
return _isEmpty;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Launch$4(final Launch occurrence) {
|
||||
double _random = Math.random();
|
||||
double vx = (_random * 2.0);
|
||||
double _random_1 = Math.random();
|
||||
double _multiply = (_random_1 * 5.5);
|
||||
double vy = (_multiply + 2.0);
|
||||
Lifecycle _$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER = this.$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER.spawnInContext(Rocket.class, _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext(), this.x, this.y, Double.valueOf(vx), Double.valueOf(vy), this.gravity, this.fireQuantity, this.grid);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$Freeze$5(final Freeze occurrence) {
|
||||
InnerContextAccess _$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER = this.$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
_$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER.getInnerContext().getDefaultSpace().emit(occurrence, null);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$Freeze$5(final Freeze it, final Freeze occurrence) {
|
||||
boolean _isFromMe = this.isFromMe(occurrence);
|
||||
boolean _not = (!_isFromMe);
|
||||
return _not;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private void $behaviorUnit$MemberLeft$6(final MemberLeft occurrence) {
|
||||
Behaviors _$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER = this.$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
Launch _launch = new Launch();
|
||||
_$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER.wake(_launch);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
private boolean $behaviorUnitGuard$MemberLeft$6(final MemberLeft it, final MemberLeft occurrence) {
|
||||
return ((!this.isFromMe(occurrence)) && (!this.exited));
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Logging.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LOGGING;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Logging.class, (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LOGGING)", imported = Logging.class)
|
||||
private Logging $CAPACITY_USE$IO_SARL_CORE_LOGGING$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LOGGING == null || this.$CAPACITY_USE$IO_SARL_CORE_LOGGING.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LOGGING = $getSkill(Logging.class);
|
||||
}
|
||||
return $castSkill(Logging.class, this.$CAPACITY_USE$IO_SARL_CORE_LOGGING);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Behaviors.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Behaviors.class, (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class)) : this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS)", imported = Behaviors.class)
|
||||
private Behaviors $CAPACITY_USE$IO_SARL_CORE_BEHAVIORS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS == null || this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS = $getSkill(Behaviors.class);
|
||||
}
|
||||
return $castSkill(Behaviors.class, this.$CAPACITY_USE$IO_SARL_CORE_BEHAVIORS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(DefaultContextInteractions.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(DefaultContextInteractions.class, (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class)) : this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS)", imported = DefaultContextInteractions.class)
|
||||
private DefaultContextInteractions $CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS == null || this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS = $getSkill(DefaultContextInteractions.class);
|
||||
}
|
||||
return $castSkill(DefaultContextInteractions.class, this.$CAPACITY_USE$IO_SARL_CORE_DEFAULTCONTEXTINTERACTIONS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(InnerContextAccess.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(InnerContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS)", imported = InnerContextAccess.class)
|
||||
private InnerContextAccess $CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS = $getSkill(InnerContextAccess.class);
|
||||
}
|
||||
return $castSkill(InnerContextAccess.class, this.$CAPACITY_USE$IO_SARL_CORE_INNERCONTEXTACCESS);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(Lifecycle.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(Lifecycle.class, (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class)) : this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE)", imported = Lifecycle.class)
|
||||
private Lifecycle $CAPACITY_USE$IO_SARL_CORE_LIFECYCLE$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE == null || this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE = $getSkill(Lifecycle.class);
|
||||
}
|
||||
return $castSkill(Lifecycle.class, this.$CAPACITY_USE$IO_SARL_CORE_LIFECYCLE);
|
||||
}
|
||||
|
||||
@Extension
|
||||
@ImportedCapacityFeature(ExternalContextAccess.class)
|
||||
@SyntheticMember
|
||||
private transient ClearableReference<Skill> $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS;
|
||||
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
@Inline(value = "$castSkill(ExternalContextAccess.class, (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) ? (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class)) : this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS)", imported = ExternalContextAccess.class)
|
||||
private ExternalContextAccess $CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS$CALLER() {
|
||||
if (this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS == null || this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS.get() == null) {
|
||||
this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS = $getSkill(ExternalContextAccess.class);
|
||||
}
|
||||
return $castSkill(ExternalContextAccess.class, this.$CAPACITY_USE$IO_SARL_CORE_EXTERNALCONTEXTACCESS);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Initialize(final Initialize occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Initialize$2(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Initialize$2(occurrence));
|
||||
}
|
||||
if ($behaviorUnitGuard$Initialize$3(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Initialize$3(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Freeze(final Freeze occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Freeze$5(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Freeze$5(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Exit(final Exit occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$Exit$0(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Exit$0(occurrence));
|
||||
}
|
||||
if ($behaviorUnitGuard$Exit$1(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Exit$1(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$MemberLeft(final MemberLeft occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
if ($behaviorUnitGuard$MemberLeft$6(occurrence, occurrence)) {
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$MemberLeft$6(occurrence));
|
||||
}
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@PerceptGuardEvaluator
|
||||
private void $guardEvaluator$Launch(final Launch occurrence, final Collection<Runnable> ___SARLlocal_runnableCollection) {
|
||||
assert occurrence != null;
|
||||
assert ___SARLlocal_runnableCollection != null;
|
||||
___SARLlocal_runnableCollection.add(() -> $behaviorUnit$Launch$4(occurrence));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RocketLauncher other = (RocketLauncher) obj;
|
||||
if (this.x == null) {
|
||||
if (other.x != null)
|
||||
return false;
|
||||
} else if (!this.x.equals(other.x))
|
||||
return false;
|
||||
if (this.y == null) {
|
||||
if (other.y != null)
|
||||
return false;
|
||||
} else if (!this.y.equals(other.y))
|
||||
return false;
|
||||
if (this.fireQuantity == null) {
|
||||
if (other.fireQuantity != null)
|
||||
return false;
|
||||
} else if (!this.fireQuantity.equals(other.fireQuantity))
|
||||
return false;
|
||||
if (this.gravity == null) {
|
||||
if (other.gravity != null)
|
||||
return false;
|
||||
} else if (!this.gravity.equals(other.gravity))
|
||||
return false;
|
||||
if (this.grid == null) {
|
||||
if (other.grid != null)
|
||||
return false;
|
||||
} else if (!this.grid.equals(other.grid))
|
||||
return false;
|
||||
if (other.exited != this.exited)
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.x== null) ? 0 : this.x.hashCode());
|
||||
result = prime * result + ((this.y== null) ? 0 : this.y.hashCode());
|
||||
result = prime * result + ((this.fireQuantity== null) ? 0 : this.fireQuantity.hashCode());
|
||||
result = prime * result + ((this.gravity== null) ? 0 : this.gravity.hashCode());
|
||||
result = prime * result + ((this.grid== null) ? 0 : this.grid.hashCode());
|
||||
result = prime * result + (this.exited ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public RocketLauncher(final UUID parentID, final UUID agentID) {
|
||||
super(parentID, agentID);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
@Inject
|
||||
public RocketLauncher(final BuiltinCapacitiesProvider provider, final UUID parentID, final UUID agentID) {
|
||||
super(provider, parentID, agentID);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class RocketReady extends Event {
|
||||
@SyntheticMember
|
||||
public RocketReady() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public RocketReady(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import java.util.Vector;
|
||||
import javafx.scene.paint.Color;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class RocketsPos {
|
||||
public final int ROCKETREFRESHDELAY = 100;
|
||||
|
||||
private Vector<Double> position = new Vector<Double>();
|
||||
|
||||
private Color color;
|
||||
|
||||
private boolean hidden = false;
|
||||
|
||||
@Pure
|
||||
public Vector<Double> getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public Vector<Double> setPosition(final Vector<Double> position) {
|
||||
return this.position = position;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Color getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public Color setColor(final Color color) {
|
||||
return this.color = color;
|
||||
}
|
||||
|
||||
public boolean setHidden(final boolean hidden) {
|
||||
return this.hidden = hidden;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public boolean getHidden() {
|
||||
return this.hidden;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RocketsPos other = (RocketsPos) obj;
|
||||
if (other.ROCKETREFRESHDELAY != this.ROCKETREFRESHDELAY)
|
||||
return false;
|
||||
if (this.position == null) {
|
||||
if (other.position != null)
|
||||
return false;
|
||||
} else if (!this.position.equals(other.position))
|
||||
return false;
|
||||
if (this.color == null) {
|
||||
if (other.color != null)
|
||||
return false;
|
||||
} else if (!this.color.equals(other.color))
|
||||
return false;
|
||||
if (other.hidden != this.hidden)
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + this.ROCKETREFRESHDELAY;
|
||||
result = prime * result + ((this.position== null) ? 0 : this.position.hashCode());
|
||||
result = prime * result + ((this.color== null) ? 0 : this.color.hashCode());
|
||||
result = prime * result + (this.hidden ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public RocketsPos() {
|
||||
super();
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Event;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class SetupSettings extends Event {
|
||||
public Integer rocketsQuantity;
|
||||
|
||||
public Integer fireQuatity;
|
||||
|
||||
public Double gravity;
|
||||
|
||||
public Double maxWidth;
|
||||
|
||||
public SetupSettings(final Integer rq, final Integer fq, final Double grav, final Double max) {
|
||||
this.rocketsQuantity = rq;
|
||||
this.fireQuatity = fq;
|
||||
this.gravity = grav;
|
||||
this.maxWidth = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SetupSettings other = (SetupSettings) obj;
|
||||
if (this.rocketsQuantity == null) {
|
||||
if (other.rocketsQuantity != null)
|
||||
return false;
|
||||
} else if (!this.rocketsQuantity.equals(other.rocketsQuantity))
|
||||
return false;
|
||||
if (this.fireQuatity == null) {
|
||||
if (other.fireQuatity != null)
|
||||
return false;
|
||||
} else if (!this.fireQuatity.equals(other.fireQuatity))
|
||||
return false;
|
||||
if (this.gravity == null) {
|
||||
if (other.gravity != null)
|
||||
return false;
|
||||
} else if (!this.gravity.equals(other.gravity))
|
||||
return false;
|
||||
if (this.maxWidth == null) {
|
||||
if (other.maxWidth != null)
|
||||
return false;
|
||||
} else if (!this.maxWidth.equals(other.maxWidth))
|
||||
return false;
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
@SyntheticMember
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.rocketsQuantity== null) ? 0 : this.rocketsQuantity.hashCode());
|
||||
result = prime * result + ((this.fireQuatity== null) ? 0 : this.fireQuatity.hashCode());
|
||||
result = prime * result + ((this.gravity== null) ? 0 : this.gravity.hashCode());
|
||||
result = prime * result + ((this.maxWidth== null) ? 0 : this.maxWidth.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of the SetupSettings event's attributes only.
|
||||
*/
|
||||
@SyntheticMember
|
||||
@Pure
|
||||
protected String attributesToString() {
|
||||
StringBuilder result = new StringBuilder(super.attributesToString());
|
||||
result.append("rocketsQuantity = ").append(this.rocketsQuantity);
|
||||
result.append("fireQuatity = ").append(this.fireQuatity);
|
||||
result.append("gravity = ").append(this.gravity);
|
||||
result.append("maxWidth = ").append(this.maxWidth);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 354887804L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class SprayFire extends Event {
|
||||
@SyntheticMember
|
||||
public SprayFire() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public SprayFire(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class UpdateFirePosition extends Event {
|
||||
@SyntheticMember
|
||||
public UpdateFirePosition() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public UpdateFirePosition(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import io.sarl.lang.annotation.SarlSpecification;
|
||||
import io.sarl.lang.annotation.SyntheticMember;
|
||||
import io.sarl.lang.core.Address;
|
||||
import io.sarl.lang.core.Event;
|
||||
|
||||
@SarlSpecification("0.5")
|
||||
@SuppressWarnings("all")
|
||||
public class UpdateRocketPosition extends Event {
|
||||
@SyntheticMember
|
||||
public UpdateRocketPosition() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
public UpdateRocketPosition(final Address source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@SyntheticMember
|
||||
private final static long serialVersionUID = 588368462L;
|
||||
}
|
170
src/main/sarl/io/sarl/demos/fireworks/FXMLViewerController.java
Normal file
170
src/main/sarl/io/sarl/demos/fireworks/FXMLViewerController.java
Normal file
@ -0,0 +1,170 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import io.sarl.lang.core.Event;
|
||||
import io.sarl.lang.core.EventListener;
|
||||
import io.sarl.util.OpenEventSpace;
|
||||
import javafx.animation.PauseTransition;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollBar;
|
||||
import javafx.util.Duration;
|
||||
|
||||
public class FXMLViewerController implements EventListener {
|
||||
|
||||
private OpenEventSpace space;
|
||||
private final UUID id = UUID.randomUUID();
|
||||
|
||||
private boolean launched = false;
|
||||
private boolean areaCreated = false;
|
||||
|
||||
@FXML private Canvas draw_zone;
|
||||
|
||||
@FXML private Label gravity_display;
|
||||
@FXML private Label rocket_quantity_display;
|
||||
@FXML private Label fire_quantity_display;
|
||||
|
||||
@FXML private ScrollBar gravity_input;
|
||||
@FXML private ScrollBar rocket_quantity_input;
|
||||
@FXML private ScrollBar fire_quantity_input;
|
||||
|
||||
@FXML private Button setup_button;
|
||||
@FXML private Button launch_button;
|
||||
@FXML private Button stop_button;
|
||||
|
||||
public void cleanExit(){
|
||||
if (this.space != null)
|
||||
this.space.emit(new Exit());
|
||||
}
|
||||
|
||||
public void setGUISpace(OpenEventSpace space) {
|
||||
this.space= space;
|
||||
this.space.register(this);
|
||||
}
|
||||
|
||||
public double getGravity() {
|
||||
return gravity_input.getValue();
|
||||
}
|
||||
|
||||
public int getRocketQuantity() {
|
||||
return (int) rocket_quantity_input.getValue();
|
||||
}
|
||||
|
||||
public int getFireQuantity() {
|
||||
return (int) fire_quantity_input.getValue();
|
||||
}
|
||||
|
||||
public void listenAndDraw(Positions grid){
|
||||
GraphicsContext gc = draw_zone.getGraphicsContext2D();
|
||||
PauseTransition wait = new PauseTransition(Duration.seconds(0.03));
|
||||
wait.setOnFinished((e) -> {
|
||||
try {
|
||||
gc.clearRect(0, 0, draw_zone.getWidth(), draw_zone.getHeight());
|
||||
grid.getRockets().values().stream().filter(rocket->!rocket.getHidden()).forEach(rocket->{
|
||||
gc.setFill(rocket.getColor());
|
||||
gc.fillOval(rocket.getPosition().get(0), rocket.getPosition().get(1), 10, 10);
|
||||
});
|
||||
grid.getFire().values().forEach(fire->{
|
||||
gc.setFill(fire.getColor());
|
||||
fire.getPositions().forEach(pos->{
|
||||
gc.fillOval(pos.get(0), pos.get(1), 5, 5);
|
||||
});
|
||||
});
|
||||
} catch (Exception exception) {}
|
||||
wait.playFromStart();
|
||||
});
|
||||
wait.play();
|
||||
}
|
||||
|
||||
@FXML public void exitApplication(ActionEvent event) {
|
||||
space.emit(new Exit());
|
||||
Platform.exit();
|
||||
}
|
||||
|
||||
@FXML protected void actionSetup(){
|
||||
SetupSettings event = new SetupSettings(
|
||||
this.getRocketQuantity(),
|
||||
this.getFireQuantity(),
|
||||
this.getGravity(),
|
||||
this.draw_zone.getWidth());
|
||||
if (!launched){
|
||||
launch_button.setDisable(false);
|
||||
Firework.main(this);
|
||||
launched = true;
|
||||
areaCreated = false;
|
||||
}
|
||||
this.space.emit(event);
|
||||
}
|
||||
|
||||
@FXML protected void actionLaunch(){
|
||||
launch_button.setDisable(true);
|
||||
stop_button.setDisable(false);
|
||||
setup_button.setDisable(true);
|
||||
if (!areaCreated){
|
||||
this.space.emit(new CreateArea());
|
||||
this.areaCreated = true;
|
||||
} else {
|
||||
this.space.emit(new Freeze(false));
|
||||
}
|
||||
}
|
||||
|
||||
@FXML protected void actionStop(){
|
||||
stop_button.setDisable(true);
|
||||
launch_button.setDisable(false);
|
||||
setup_button.setDisable(false);
|
||||
this.space.emit(new Freeze(true));
|
||||
}
|
||||
@FXML protected void actionGravityDisplay(){
|
||||
gravity_input.valueProperty().addListener(new ChangeListener<Number>() {
|
||||
public void changed(ObservableValue<? extends Number> ov,
|
||||
Number old_val, Number new_val){
|
||||
gravity_display.setText(String.format("%.1f", gravity_input.getValue()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@FXML protected void actionRocketQuantityDisplay(){
|
||||
rocket_quantity_input.valueProperty().addListener(new ChangeListener<Number>() {
|
||||
public void changed(ObservableValue<? extends Number> ov,
|
||||
Number old_val, Number new_val){
|
||||
rocket_quantity_display.setText(String.format("%.0f", rocket_quantity_input.getValue()));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@FXML protected void actionFireQuantityDisplay(){
|
||||
fire_quantity_input.valueProperty().addListener(new ChangeListener<Number>() {
|
||||
public void changed(ObservableValue<? extends Number> ov,
|
||||
Number old_val, Number new_val){
|
||||
fire_quantity_display.setText(String.format("%.0f", fire_quantity_input.getValue()));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getID() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveEvent(Event event) {
|
||||
/*
|
||||
if (event instanceof TestEvent){
|
||||
System.out.println("Guy recieved an event " + ((TestEvent) event).message);
|
||||
this.space.emit(new TestEventHack());
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
111
src/main/sarl/io/sarl/demos/fireworks/Fire.sarl
Normal file
111
src/main/sarl/io/sarl/demos/fireworks/Fire.sarl
Normal file
@ -0,0 +1,111 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.sarl.core.AgentTask
|
||||
import io.sarl.core.Behaviors
|
||||
import io.sarl.core.DefaultContextInteractions
|
||||
import io.sarl.core.ExternalContextAccess
|
||||
import io.sarl.core.Initialize
|
||||
import io.sarl.core.Lifecycle
|
||||
import io.sarl.core.Logging
|
||||
import io.sarl.core.Schedules
|
||||
import io.sarl.core.Time
|
||||
import io.sarl.util.Scopes
|
||||
import java.util.ArrayList
|
||||
import java.util.List
|
||||
import java.util.UUID
|
||||
import java.util.Vector
|
||||
|
||||
agent Fire {
|
||||
uses Lifecycle, Logging, Behaviors, DefaultContextInteractions, ExternalContextAccess, Schedules, Time
|
||||
|
||||
var x: List<Double>
|
||||
var y: List<Double>
|
||||
var lifetime = 300
|
||||
var frozen = false
|
||||
var destroyed = false
|
||||
var exited = false
|
||||
var grid: Positions
|
||||
var xf: Double
|
||||
var yf: Double
|
||||
var id = UUID.randomUUID
|
||||
var parentID: UUID
|
||||
var move: AgentTask
|
||||
var parentAgent: UUID
|
||||
|
||||
on Freeze {
|
||||
this.frozen = occurrence.value
|
||||
if (frozen)
|
||||
cancel(move, true)
|
||||
else
|
||||
wake(new UpdateFirePosition)
|
||||
}
|
||||
|
||||
on Initialize {
|
||||
x = new ArrayList()
|
||||
y = new ArrayList()
|
||||
if (occurrence.parameters.size.equals(4)){
|
||||
x.add(occurrence.parameters.get(0) as Double)
|
||||
y.add(occurrence.parameters.get(1) as Double)
|
||||
grid = occurrence.parameters.get(2) as Positions
|
||||
parentID = occurrence.parameters.get(3) as UUID
|
||||
} else {
|
||||
info("Error in fire Initialize : bad parameter number")
|
||||
}
|
||||
parentAgent = occurrence.spawner
|
||||
|
||||
xf = Math.random() * 10.0 - Math.random() * 5
|
||||
yf = Math.random() * 10.0 + 1.0
|
||||
|
||||
|
||||
}
|
||||
|
||||
on FireReady {
|
||||
move = atFixedDelay(30)[try{
|
||||
wake(new UpdateFirePosition);}
|
||||
catch(e: Exception) {e.printStackTrace}]
|
||||
}
|
||||
|
||||
on UpdateFirePosition [isFromMe(occurrence) && !frozen && !destroyed]{
|
||||
var newx = x.last + xf
|
||||
var newy = y.last + yf
|
||||
x.add(newx)
|
||||
y.add(newy)
|
||||
|
||||
if (grid !== null){
|
||||
var list = new ArrayList<Vector<Double>>
|
||||
x.forEach[pos | {
|
||||
var nvect = new Vector(2)
|
||||
nvect.add(pos)
|
||||
list.add(nvect)
|
||||
}]
|
||||
y.forEach[pos, i | {
|
||||
var nvect = list.get(i)
|
||||
nvect.add(pos)
|
||||
list.set(i, nvect)
|
||||
}]
|
||||
grid.setFirePosition(id, parentID, list)
|
||||
}
|
||||
|
||||
lifetime = lifetime - 10
|
||||
|
||||
if (lifetime <= 0){
|
||||
grid.removeFirePosition(id)
|
||||
this.cleanBeforeExit
|
||||
in(1000)[killMe]
|
||||
}
|
||||
}
|
||||
|
||||
def cleanBeforeExit(){
|
||||
cancel(move, true)
|
||||
exited = true
|
||||
destroyed = true
|
||||
}
|
||||
|
||||
on Exit [!exited && isFrom(getParentID)] {
|
||||
frozen = true
|
||||
this.cleanBeforeExit
|
||||
emit(new Exit, Scopes.addresses(defaultSpace.getAddress(parentAgent)))
|
||||
killMe
|
||||
}
|
||||
|
||||
}
|
44
src/main/sarl/io/sarl/demos/fireworks/Fireworks.sarl
Normal file
44
src/main/sarl/io/sarl/demos/fireworks/Fireworks.sarl
Normal file
@ -0,0 +1,44 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.janusproject.Boot
|
||||
|
||||
import static io.janusproject.Boot.*
|
||||
|
||||
event Launch
|
||||
event CreateArea
|
||||
event Explode
|
||||
event KillRocket
|
||||
event KillFire
|
||||
event RocketReady
|
||||
event UpdateRocketPosition
|
||||
event UpdateFirePosition
|
||||
event FireReady
|
||||
event SprayFire
|
||||
event Exit
|
||||
|
||||
event Freeze {
|
||||
var value: boolean
|
||||
new (value: boolean){
|
||||
this.value = value
|
||||
}
|
||||
}
|
||||
|
||||
event SetupSettings {
|
||||
var rocketsQuantity: Integer
|
||||
var fireQuatity: Integer
|
||||
var gravity: Double
|
||||
var maxWidth: Double
|
||||
new(rq: Integer, fq: Integer, grav: Double, max: Double){
|
||||
rocketsQuantity = rq
|
||||
fireQuatity = fq
|
||||
gravity = grav
|
||||
maxWidth = max
|
||||
}
|
||||
}
|
||||
|
||||
class Firework {
|
||||
static def main(controller: FXMLViewerController) {
|
||||
Boot::offline = true
|
||||
Boot::startJanus(typeof(LaunchingArea), controller)
|
||||
}
|
||||
}
|
82
src/main/sarl/io/sarl/demos/fireworks/LaunchingArea.sarl
Normal file
82
src/main/sarl/io/sarl/demos/fireworks/LaunchingArea.sarl
Normal file
@ -0,0 +1,82 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.sarl.core.Behaviors
|
||||
import io.sarl.core.DefaultContextInteractions
|
||||
import io.sarl.core.ExternalContextAccess
|
||||
import io.sarl.core.Initialize
|
||||
import io.sarl.core.InnerContextAccess
|
||||
import io.sarl.core.Lifecycle
|
||||
import io.sarl.core.Logging
|
||||
import io.sarl.core.MemberJoined
|
||||
import io.sarl.util.OpenEventSpaceSpecification
|
||||
import java.util.Random
|
||||
import java.util.UUID
|
||||
|
||||
agent LaunchingArea {
|
||||
uses DefaultContextInteractions, Lifecycle, Behaviors, Logging, InnerContextAccess, ExternalContextAccess
|
||||
|
||||
var rocketsQuantity: Integer
|
||||
var fireQuantity: Integer
|
||||
var gravity: Double
|
||||
var grid: Positions = new Positions
|
||||
var maxWidth = 10.0
|
||||
var exited = false
|
||||
|
||||
on SetupSettings {
|
||||
this.rocketsQuantity = occurrence.rocketsQuantity
|
||||
this.fireQuantity = occurrence.fireQuatity
|
||||
this.gravity = occurrence.gravity
|
||||
this.maxWidth = occurrence.maxWidth
|
||||
}
|
||||
|
||||
on Exit [!hasMemberAgent]{
|
||||
killMe
|
||||
}
|
||||
|
||||
on Exit [hasMemberAgent && !exited] {
|
||||
exited = true
|
||||
innerContext.defaultSpace.emit(new Exit)
|
||||
}
|
||||
|
||||
on Initialize [ occurrence.parameters.empty ] {
|
||||
rocketsQuantity = 20
|
||||
fireQuantity = 30
|
||||
gravity = 0.5
|
||||
|
||||
info("Setup Area")
|
||||
|
||||
}
|
||||
|
||||
on Initialize [ !occurrence.parameters.empty ]{
|
||||
var ctrl = occurrence.parameters.get(0) as FXMLViewerController
|
||||
var ^space = defaultContext.createSpace(OpenEventSpaceSpecification, UUID.randomUUID)
|
||||
ctrl.setGUISpace(^space)
|
||||
^space.register(asEventListener)
|
||||
|
||||
ctrl.listenAndDraw(grid)
|
||||
|
||||
info("Setup Area")
|
||||
|
||||
}
|
||||
|
||||
on CreateArea {
|
||||
var x: Double
|
||||
var i=0
|
||||
var rnd = new Random()
|
||||
while (i<rocketsQuantity){
|
||||
x = rnd.nextDouble() * maxWidth
|
||||
spawnInContext(RocketLauncher, getInnerContext, x, 0.0, fireQuantity, gravity, grid)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
on Freeze[!isFromMe(occurrence)] {
|
||||
innerContext.defaultSpace.emit(occurrence)
|
||||
}
|
||||
|
||||
on MemberJoined [ occurrence.inInnerDefaultSpace && memberAgentCount == rocketsQuantity]{
|
||||
info("Area Ready")
|
||||
innerContext.defaultSpace.emit(new Launch)
|
||||
}
|
||||
|
||||
}
|
116
src/main/sarl/io/sarl/demos/fireworks/Positions.sarl
Normal file
116
src/main/sarl/io/sarl/demos/fireworks/Positions.sarl
Normal file
@ -0,0 +1,116 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import java.util.HashMap
|
||||
import java.util.List
|
||||
import java.util.Map
|
||||
import java.util.UUID
|
||||
import java.util.Vector
|
||||
import javafx.scene.paint.Color
|
||||
|
||||
class RocketsPos {
|
||||
public val ROCKETREFRESHDELAY = 100
|
||||
var position = new Vector<Double>()
|
||||
var color: Color
|
||||
var hidden = false
|
||||
|
||||
public def getPosition(){
|
||||
return position
|
||||
}
|
||||
|
||||
public def setPosition(position: Vector<Double>){
|
||||
this.position = position
|
||||
}
|
||||
|
||||
public def getColor(){
|
||||
return color
|
||||
}
|
||||
|
||||
public def setColor(color: Color){
|
||||
this.color = color
|
||||
}
|
||||
|
||||
public def setHidden(hidden: boolean){
|
||||
this.hidden = hidden
|
||||
}
|
||||
|
||||
public def getHidden(){
|
||||
return this.hidden
|
||||
}
|
||||
}
|
||||
|
||||
class FirePos {
|
||||
public val FIREREFRESHDELAY = 100
|
||||
var positions: List<Vector<Double>>
|
||||
var color: Color
|
||||
|
||||
public def getPositions(){
|
||||
return positions
|
||||
}
|
||||
|
||||
public def setPositions(positions: List<Vector<Double>>){
|
||||
this.positions = positions
|
||||
}
|
||||
|
||||
public def getColor(){
|
||||
return color
|
||||
}
|
||||
|
||||
public def setColor(color: Color){
|
||||
this.color = color
|
||||
}
|
||||
}
|
||||
|
||||
class Positions {
|
||||
var rockets = new HashMap<UUID, RocketsPos>()
|
||||
var fire = new HashMap<UUID, FirePos>()
|
||||
|
||||
|
||||
public def getRockets() : Map<UUID, RocketsPos> {
|
||||
return rockets.unmodifiableView
|
||||
}
|
||||
|
||||
public def getFire() : Map<UUID, FirePos> {
|
||||
return fire.unmodifiableView
|
||||
}
|
||||
|
||||
public def setRocketPosition(id: UUID, position: Vector<Double>){
|
||||
var pos = new RocketsPos()
|
||||
pos.setPosition(position)
|
||||
if (rockets.containsKey(id)){
|
||||
pos.setColor(rockets.get(id).getColor)
|
||||
rockets.replace(id, pos)
|
||||
} else {
|
||||
pos.setColor(Color.color(Math.random(), Math.random(), Math.random()))
|
||||
rockets.put(id, pos)
|
||||
}
|
||||
}
|
||||
|
||||
public def removeRocketPosition(id: UUID){
|
||||
rockets.remove(id)
|
||||
}
|
||||
|
||||
public def hideHocketPosition(id: UUID){
|
||||
rockets.get(id).setHidden(true)
|
||||
}
|
||||
|
||||
public def setFirePosition(id: UUID, rocketID: UUID, positions: List<Vector<Double>>){
|
||||
var pos = new FirePos()
|
||||
pos.setPositions(positions)
|
||||
if (fire.containsKey(id)){
|
||||
pos.setColor(fire.get(id).getColor)
|
||||
fire.replace(id, pos)
|
||||
} else {
|
||||
if (this.rockets.containsKey(rocketID))
|
||||
pos.setColor(this.rockets.get(rocketID).getColor)
|
||||
else
|
||||
pos.setColor(Color.color(Math.random(), Math.random(), Math.random()))
|
||||
fire.put(id, pos)
|
||||
}
|
||||
}
|
||||
|
||||
public def removeFirePosition(id: UUID){
|
||||
fire.remove(id)
|
||||
}
|
||||
|
||||
}
|
||||
|
115
src/main/sarl/io/sarl/demos/fireworks/Rocket.sarl
Normal file
115
src/main/sarl/io/sarl/demos/fireworks/Rocket.sarl
Normal file
@ -0,0 +1,115 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.sarl.core.AgentTask
|
||||
import io.sarl.core.Behaviors
|
||||
import io.sarl.core.DefaultContextInteractions
|
||||
import io.sarl.core.ExternalContextAccess
|
||||
import io.sarl.core.Initialize
|
||||
import io.sarl.core.InnerContextAccess
|
||||
import io.sarl.core.Lifecycle
|
||||
import io.sarl.core.Logging
|
||||
import io.sarl.core.MemberJoined
|
||||
import io.sarl.core.MemberLeft
|
||||
import io.sarl.core.Schedules
|
||||
import java.util.Random
|
||||
import java.util.UUID
|
||||
import java.util.Vector
|
||||
|
||||
agent Rocket {
|
||||
|
||||
uses Lifecycle, Logging, Schedules, Behaviors, DefaultContextInteractions, InnerContextAccess, ExternalContextAccess
|
||||
var x : Double
|
||||
var y : Double
|
||||
var gravity : Double
|
||||
var speedx : Double
|
||||
var speedy : Double
|
||||
var fireQuantity : Integer
|
||||
var lifetime : Integer
|
||||
var frozen = false
|
||||
var exploded = false
|
||||
var exited = false
|
||||
var grid: Positions
|
||||
var id: UUID
|
||||
var move: AgentTask
|
||||
|
||||
on Exit [!hasMemberAgent]{
|
||||
emit(new Exit)
|
||||
killMe
|
||||
}
|
||||
|
||||
on Exit [hasMemberAgent && !exited]{
|
||||
exploded = true
|
||||
frozen = true
|
||||
exited = true
|
||||
cancel(move, true)
|
||||
|
||||
innerContext.defaultSpace.emit(new Exit)
|
||||
}
|
||||
|
||||
on Freeze {
|
||||
this.frozen = occurrence.value
|
||||
if (frozen)
|
||||
cancel(move, true)
|
||||
if (!frozen)
|
||||
wake(new UpdateRocketPosition)
|
||||
}
|
||||
|
||||
on Initialize {
|
||||
info("New rocket launched")
|
||||
var rnd = new Random()
|
||||
if (occurrence.parameters.size.equals(7)){
|
||||
x = occurrence.parameters.get(0) as Double
|
||||
y = occurrence.parameters.get(1) as Double
|
||||
speedx = occurrence.parameters.get(2) as Double
|
||||
speedy = occurrence.parameters.get(3) as Double
|
||||
gravity = occurrence.parameters.get(4) as Double
|
||||
fireQuantity = occurrence.parameters.get(5) as Integer
|
||||
grid = occurrence.parameters.get(6) as Positions
|
||||
} else {
|
||||
info("Error in Fireworks Initialize : bad parameters number")
|
||||
}
|
||||
lifetime = rnd.nextInt(5) * 300 + 300
|
||||
id = UUID.randomUUID
|
||||
|
||||
move = atFixedDelay(30)[try{
|
||||
wake(new UpdateRocketPosition);}
|
||||
catch(e: Exception) {e.printStackTrace}]
|
||||
}
|
||||
|
||||
on UpdateRocketPosition [isFromMe(occurrence) && !frozen && !exploded] {
|
||||
var vect = new Vector(2)
|
||||
x = x + speedx
|
||||
y = y + speedy
|
||||
vect.clear()
|
||||
vect.add(x)
|
||||
vect.add(y)
|
||||
lifetime = lifetime - 10
|
||||
if (grid!==null)
|
||||
grid.setRocketPosition(id, vect)
|
||||
if (lifetime <= 0){
|
||||
exploded = true
|
||||
cancel(move, true)
|
||||
grid.hideHocketPosition(id)
|
||||
wake(new Explode)
|
||||
}
|
||||
}
|
||||
|
||||
on Explode {
|
||||
for (var i=0; i < fireQuantity; i++){
|
||||
spawnInContext(Fire, innerContext, x, y, grid, id)
|
||||
}
|
||||
// emit(new Launch)
|
||||
}
|
||||
|
||||
on MemberLeft [!isFromMe(occurrence) && !frozen && !hasMemberAgent] {
|
||||
exited = true
|
||||
grid.removeRocketPosition(id)
|
||||
// emit(new Launch)
|
||||
killMe
|
||||
}
|
||||
|
||||
on MemberJoined [!isFromMe(occurrence) && hasMemberAgent && memberAgentCount == fireQuantity]{
|
||||
innerContext.defaultSpace.emit(new FireReady)
|
||||
}
|
||||
|
||||
}
|
74
src/main/sarl/io/sarl/demos/fireworks/RocketLauncher.sarl
Normal file
74
src/main/sarl/io/sarl/demos/fireworks/RocketLauncher.sarl
Normal file
@ -0,0 +1,74 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.sarl.core.Behaviors
|
||||
import io.sarl.core.DefaultContextInteractions
|
||||
import io.sarl.core.ExternalContextAccess
|
||||
import io.sarl.core.Initialize
|
||||
import io.sarl.core.InnerContextAccess
|
||||
import io.sarl.core.Lifecycle
|
||||
import io.sarl.core.Logging
|
||||
import io.sarl.core.MemberLeft
|
||||
import io.sarl.demos.fireworks.Exit
|
||||
import io.sarl.demos.fireworks.Freeze
|
||||
import io.sarl.demos.fireworks.Launch
|
||||
import io.sarl.demos.fireworks.Positions
|
||||
import io.sarl.demos.fireworks.Rocket
|
||||
import io.sarl.demos.fireworks.RocketReady
|
||||
|
||||
agent RocketLauncher {
|
||||
|
||||
uses Logging, Behaviors, DefaultContextInteractions, InnerContextAccess, Lifecycle, ExternalContextAccess
|
||||
|
||||
var x: Double
|
||||
var y: Double
|
||||
var fireQuantity : Integer
|
||||
var gravity : Double
|
||||
var grid: Positions
|
||||
var exited = false
|
||||
|
||||
on Exit [!hasMemberAgent] {
|
||||
emit(new Exit)
|
||||
killMe
|
||||
}
|
||||
|
||||
on Exit [hasMemberAgent && !exited] {
|
||||
exited = true
|
||||
innerContext.defaultSpace.emit(new Exit)
|
||||
}
|
||||
|
||||
on Initialize [!occurrence.parameters.empty] {
|
||||
x = occurrence.parameters.get(0) as Double
|
||||
y = occurrence.parameters.get(1) as Double
|
||||
fireQuantity = occurrence.parameters.get(2) as Integer
|
||||
gravity = occurrence.parameters.get(3) as Double
|
||||
grid = occurrence.parameters.get(4) as Positions
|
||||
|
||||
info("New rocket launcher created")
|
||||
}
|
||||
|
||||
on Initialize [occurrence.parameters.empty]{
|
||||
x = 0.0
|
||||
y = 0.0
|
||||
fireQuantity = 30
|
||||
gravity = 0.5
|
||||
grid = null
|
||||
|
||||
info("New rocket launcher created")
|
||||
emit(new RocketReady)
|
||||
}
|
||||
|
||||
on Launch {
|
||||
var vx = Math.random() * 2.0
|
||||
var vy = Math.random() * 5.5 + 2.0
|
||||
spawnInContext(Rocket, getInnerContext, x, y, vx, vy, gravity, fireQuantity, grid)
|
||||
}
|
||||
|
||||
on Freeze[!isFromMe(occurrence)] {
|
||||
innerContext.defaultSpace.emit(occurrence)
|
||||
}
|
||||
|
||||
on MemberLeft [!isFromMe(occurrence) && !exited]{
|
||||
wake(new Launch)
|
||||
}
|
||||
|
||||
}
|
40
src/main/sarl/io/sarl/demos/fireworks/Viewer.java
Normal file
40
src/main/sarl/io/sarl/demos/fireworks/Viewer.java
Normal file
@ -0,0 +1,40 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.JavaFXBuilderFactory;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Viewer extends Application {
|
||||
|
||||
private FXMLLoader loader;
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception {
|
||||
URL location = getClass().getResource("viewer.fxml");
|
||||
loader = new FXMLLoader();
|
||||
loader.setLocation(location);
|
||||
loader.setBuilderFactory(new JavaFXBuilderFactory());
|
||||
Parent root = (Parent) loader.load(location.openStream());
|
||||
Scene scene = new Scene(root);
|
||||
stage.setTitle("Firewoks sarl animation");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
super.stop();
|
||||
((FXMLViewerController) loader.getController()).cleanExit();
|
||||
}
|
||||
|
||||
}
|
39
src/main/sarl/io/sarl/demos/fireworks/viewer.fxml
Normal file
39
src/main/sarl/io/sarl/demos/fireworks/viewer.fxml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.effect.*?>
|
||||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.canvas.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="608.0" prefWidth="933.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.sarl.demos.fireworks.FXMLViewerController">
|
||||
<children>
|
||||
<Canvas fx:id="draw_zone" height="583.0" layoutX="199.0" layoutY="13.0" rotate="180.0" width="715.0" />
|
||||
<Button fx:id="setup_button" layoutX="26.0" layoutY="45.0" mnemonicParsing="false" onAction="#actionSetup" text="Setup" />
|
||||
<Button fx:id="launch_button" disable="true" layoutX="26.0" layoutY="89.0" mnemonicParsing="false" onAction="#actionLaunch" text="Launch" />
|
||||
<AnchorPane layoutX="30.0" layoutY="145.0">
|
||||
<children>
|
||||
<ScrollBar fx:id="gravity_input" max="3.0" onMouseEntered="#actionGravityDisplay" prefHeight="17.0" prefWidth="159.0" unitIncrement="0.1" value="0.5" />
|
||||
<Label fx:id="gravity_display" layoutX="113.0" layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="0,5" />
|
||||
<Label layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="gravity" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane layoutX="27.0" layoutY="255.0">
|
||||
<children>
|
||||
<Label layoutX="4.0" layoutY="17.0" text="fire quantity" />
|
||||
<Label fx:id="fire_quantity_display" layoutX="117.0" layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="30" />
|
||||
<ScrollBar fx:id="fire_quantity_input" layoutX="4.0" max="50.0" min="5.0" onMouseEntered="#actionFireQuantityDisplay" prefHeight="17.0" prefWidth="159.0" value="30.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane layoutX="30.0" layoutY="199.0">
|
||||
<children>
|
||||
<ScrollBar fx:id="rocket_quantity_input" max="40.0" min="1.0" onMouseEntered="#actionRocketQuantityDisplay" prefHeight="17.0" prefWidth="159.0" value="20.0" />
|
||||
<Label layoutY="20.0" text="rocket quantity" />
|
||||
<Label fx:id="rocket_quantity_display" layoutX="113.0" layoutY="20.0" prefHeight="17.0" prefWidth="46.0" text="20" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<Button fx:id="stop_button" disable="true" layoutX="117.0" layoutY="89.0" mnemonicParsing="false" onAction="#actionStop" text="Stop" />
|
||||
</children>
|
||||
</Pane>
|
BIN
target/classes/io/sarl/demos/fireworks/.CreateArea.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.CreateArea.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Exit.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Exit.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Explode.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Explode.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Fire.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Fire.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Fire.sarlbin
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Fire.sarlbin
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.FirePos.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.FirePos.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.FireReady.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.FireReady.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Firework.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Firework.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Freeze.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Freeze.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.KillFire.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.KillFire.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.KillRocket.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.KillRocket.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Launch.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Launch.java._trace
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.LaunchingArea.sarlbin
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.LaunchingArea.sarlbin
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Positions.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Positions.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Positions.sarlbin
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Positions.sarlbin
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Rocket.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Rocket.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.Rocket.sarlbin
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.Rocket.sarlbin
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.RocketLauncher.sarlbin
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.RocketLauncher.sarlbin
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.RocketReady.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.RocketReady.java._trace
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.RocketsPos.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.RocketsPos.java._trace
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.SprayFire.java._trace
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.SprayFire.java._trace
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/.fireworks.sarlbin
Normal file
BIN
target/classes/io/sarl/demos/fireworks/.fireworks.sarlbin
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/CreateArea.class
Normal file
BIN
target/classes/io/sarl/demos/fireworks/CreateArea.class
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/Exit.class
Normal file
BIN
target/classes/io/sarl/demos/fireworks/Exit.class
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/Explode.class
Normal file
BIN
target/classes/io/sarl/demos/fireworks/Explode.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/Fire.class
Normal file
BIN
target/classes/io/sarl/demos/fireworks/Fire.class
Normal file
Binary file not shown.
111
target/classes/io/sarl/demos/fireworks/Fire.sarl
Normal file
111
target/classes/io/sarl/demos/fireworks/Fire.sarl
Normal file
@ -0,0 +1,111 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.sarl.core.AgentTask
|
||||
import io.sarl.core.Behaviors
|
||||
import io.sarl.core.DefaultContextInteractions
|
||||
import io.sarl.core.ExternalContextAccess
|
||||
import io.sarl.core.Initialize
|
||||
import io.sarl.core.Lifecycle
|
||||
import io.sarl.core.Logging
|
||||
import io.sarl.core.Schedules
|
||||
import io.sarl.core.Time
|
||||
import io.sarl.util.Scopes
|
||||
import java.util.ArrayList
|
||||
import java.util.List
|
||||
import java.util.UUID
|
||||
import java.util.Vector
|
||||
|
||||
agent Fire {
|
||||
uses Lifecycle, Logging, Behaviors, DefaultContextInteractions, ExternalContextAccess, Schedules, Time
|
||||
|
||||
var x: List<Double>
|
||||
var y: List<Double>
|
||||
var lifetime = 300
|
||||
var frozen = false
|
||||
var destroyed = false
|
||||
var exited = false
|
||||
var grid: Positions
|
||||
var xf: Double
|
||||
var yf: Double
|
||||
var id = UUID.randomUUID
|
||||
var parentID: UUID
|
||||
var move: AgentTask
|
||||
var parentAgent: UUID
|
||||
|
||||
on Freeze {
|
||||
this.frozen = occurrence.value
|
||||
if (frozen)
|
||||
cancel(move, true)
|
||||
else
|
||||
wake(new UpdateFirePosition)
|
||||
}
|
||||
|
||||
on Initialize {
|
||||
x = new ArrayList()
|
||||
y = new ArrayList()
|
||||
if (occurrence.parameters.size.equals(4)){
|
||||
x.add(occurrence.parameters.get(0) as Double)
|
||||
y.add(occurrence.parameters.get(1) as Double)
|
||||
grid = occurrence.parameters.get(2) as Positions
|
||||
parentID = occurrence.parameters.get(3) as UUID
|
||||
} else {
|
||||
info("Error in fire Initialize : bad parameter number")
|
||||
}
|
||||
parentAgent = occurrence.spawner
|
||||
|
||||
xf = Math.random() * 10.0 - Math.random() * 5
|
||||
yf = Math.random() * 10.0 + 1.0
|
||||
|
||||
|
||||
}
|
||||
|
||||
on FireReady {
|
||||
move = atFixedDelay(30)[try{
|
||||
wake(new UpdateFirePosition);}
|
||||
catch(e: Exception) {e.printStackTrace}]
|
||||
}
|
||||
|
||||
on UpdateFirePosition [isFromMe(occurrence) && !frozen && !destroyed]{
|
||||
var newx = x.last + xf
|
||||
var newy = y.last + yf
|
||||
x.add(newx)
|
||||
y.add(newy)
|
||||
|
||||
if (grid !== null){
|
||||
var list = new ArrayList<Vector<Double>>
|
||||
x.forEach[pos | {
|
||||
var nvect = new Vector(2)
|
||||
nvect.add(pos)
|
||||
list.add(nvect)
|
||||
}]
|
||||
y.forEach[pos, i | {
|
||||
var nvect = list.get(i)
|
||||
nvect.add(pos)
|
||||
list.set(i, nvect)
|
||||
}]
|
||||
grid.setFirePosition(id, parentID, list)
|
||||
}
|
||||
|
||||
lifetime = lifetime - 10
|
||||
|
||||
if (lifetime <= 0){
|
||||
grid.removeFirePosition(id)
|
||||
this.cleanBeforeExit
|
||||
in(1000)[killMe]
|
||||
}
|
||||
}
|
||||
|
||||
def cleanBeforeExit(){
|
||||
cancel(move, true)
|
||||
exited = true
|
||||
destroyed = true
|
||||
}
|
||||
|
||||
on Exit [!exited && isFrom(getParentID)] {
|
||||
frozen = true
|
||||
this.cleanBeforeExit
|
||||
emit(new Exit, Scopes.addresses(defaultSpace.getAddress(parentAgent)))
|
||||
killMe
|
||||
}
|
||||
|
||||
}
|
BIN
target/classes/io/sarl/demos/fireworks/FirePos.class
Normal file
BIN
target/classes/io/sarl/demos/fireworks/FirePos.class
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/FireReady.class
Normal file
BIN
target/classes/io/sarl/demos/fireworks/FireReady.class
Normal file
Binary file not shown.
BIN
target/classes/io/sarl/demos/fireworks/Firework.class
Normal file
BIN
target/classes/io/sarl/demos/fireworks/Firework.class
Normal file
Binary file not shown.
44
target/classes/io/sarl/demos/fireworks/Fireworks.sarl
Normal file
44
target/classes/io/sarl/demos/fireworks/Fireworks.sarl
Normal file
@ -0,0 +1,44 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.janusproject.Boot
|
||||
|
||||
import static io.janusproject.Boot.*
|
||||
|
||||
event Launch
|
||||
event CreateArea
|
||||
event Explode
|
||||
event KillRocket
|
||||
event KillFire
|
||||
event RocketReady
|
||||
event UpdateRocketPosition
|
||||
event UpdateFirePosition
|
||||
event FireReady
|
||||
event SprayFire
|
||||
event Exit
|
||||
|
||||
event Freeze {
|
||||
var value: boolean
|
||||
new (value: boolean){
|
||||
this.value = value
|
||||
}
|
||||
}
|
||||
|
||||
event SetupSettings {
|
||||
var rocketsQuantity: Integer
|
||||
var fireQuatity: Integer
|
||||
var gravity: Double
|
||||
var maxWidth: Double
|
||||
new(rq: Integer, fq: Integer, grav: Double, max: Double){
|
||||
rocketsQuantity = rq
|
||||
fireQuatity = fq
|
||||
gravity = grav
|
||||
maxWidth = max
|
||||
}
|
||||
}
|
||||
|
||||
class Firework {
|
||||
static def main(controller: FXMLViewerController) {
|
||||
Boot::offline = true
|
||||
Boot::startJanus(typeof(LaunchingArea), controller)
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user