1
0
mirror of https://github.com/klmp200/sarl-fireworks.git synced 2024-11-21 14:23:19 +00:00

Removing eclipse related files and class files

This commit is contained in:
ngaud 2017-05-02 15:56:56 +02:00
parent a4f711ebcc
commit 3df4ebb395
63 changed files with 0 additions and 632 deletions

View File

@ -1,15 +0,0 @@
<?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>

View File

@ -1,24 +0,0 @@
<?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>

View File

@ -1,12 +0,0 @@
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

View File

@ -1,111 +0,0 @@
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
}
}

View File

@ -1,44 +0,0 @@
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)
}
}

View File

@ -1,82 +0,0 @@
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)
}
}

View File

@ -1,116 +0,0 @@
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)
}
}

View File

@ -1,115 +0,0 @@
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)
}
}

View File

@ -1,74 +0,0 @@
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)
}
}

View File

@ -1,39 +0,0 @@
<?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>