-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/d3scomp/JDEECo.git
- Loading branch information
Showing
16 changed files
with
286 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
jdeeco-core/src/cz/cuni/mff/d3s/deeco/invokable/MembershipMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package cz.cuni.mff.d3s.deeco.logging; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* API for sending log output. | ||
* | ||
|
1 change: 1 addition & 0 deletions
1
jdeeco-core/src/cz/cuni/mff/d3s/deeco/logging/StandardLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Manifest-Version: 1.0 | ||
Ant-Version: Apache Ant 1.8.4 | ||
Created-By: 1.7.0_06-b24 (Oracle Corporation) | ||
Export-Package: cz.cuni.mff.d3s.deeco.demo.convoytut | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
jpf-base-dir = . | ||
|
||
jpf-core = ${jpf-base-dir}/jpf-core | ||
|
||
jpf-ltl = ${jpf-base-dir}/jpf-ltl | ||
|
||
extensions+=,${jpf-ltl} | ||
|
38 changes: 38 additions & 0 deletions
38
jdeeco-demo/src/cz/cuni/mff/d3s/deeco/demo/convoytut/ConvoyEnsemble.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cz.cuni.mff.d3s.deeco.demo.convoytut; | ||
|
||
import java.util.List; | ||
|
||
import cz.cuni.mff.d3s.deeco.annotations.KnowledgeExchange; | ||
import cz.cuni.mff.d3s.deeco.annotations.Membership; | ||
import cz.cuni.mff.d3s.deeco.annotations.In; | ||
import cz.cuni.mff.d3s.deeco.annotations.Out; | ||
import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling; | ||
import cz.cuni.mff.d3s.deeco.ensemble.Ensemble; | ||
import cz.cuni.mff.d3s.deeco.knowledge.OutWrapper; | ||
|
||
|
||
|
||
public class ConvoyEnsemble extends Ensemble { | ||
|
||
@Membership | ||
public static boolean membership( | ||
@In("member.position") Waypoint fPosition, | ||
@In("member.destination") Waypoint fDestination, | ||
@In("coord.position") Waypoint lPosition, | ||
@In("coord.path") List<Waypoint> lPath) { | ||
|
||
return | ||
!fPosition.equals(fDestination) && | ||
(Math.abs(lPosition.x - fPosition.x) + Math.abs(lPosition.y - fPosition.y)) <= 2 && | ||
lPath.contains(fDestination); | ||
} | ||
|
||
@KnowledgeExchange | ||
@PeriodicScheduling(200) | ||
public static void map( | ||
@Out("member.leaderPosition") OutWrapper<Waypoint> fLeaderPosition, | ||
@In("coord.position") Waypoint lPosition) { | ||
|
||
fLeaderPosition.value = lPosition; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
jdeeco-demo/src/cz/cuni/mff/d3s/deeco/demo/convoytut/Follower.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cz.cuni.mff.d3s.deeco.demo.convoytut; | ||
|
||
import cz.cuni.mff.d3s.deeco.annotations.In; | ||
import cz.cuni.mff.d3s.deeco.annotations.InOut; | ||
import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling; | ||
import cz.cuni.mff.d3s.deeco.annotations.Process; | ||
import cz.cuni.mff.d3s.deeco.knowledge.Component; | ||
|
||
public class Follower extends Component { | ||
|
||
public String name = "F"; | ||
public Waypoint position = new Waypoint(1, 4); | ||
public Waypoint destination = new Waypoint(7, 2); | ||
public Waypoint leaderPosition; | ||
|
||
@Process | ||
@PeriodicScheduling(1000) | ||
public static void followProcess( | ||
@InOut("position") Waypoint me, | ||
@In("destination") Waypoint destination, | ||
@In("name") String name, | ||
@In("leaderPosition") Waypoint leader | ||
) { | ||
|
||
if (!destination.equals(me) && leader != null) { | ||
me.x += Integer.signum(leader.x - me.x); | ||
me.y += Integer.signum(leader.y - me.y); | ||
} | ||
|
||
System.out.println("Follower " + name + ": me = " + me + " leader = " + leader); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
jdeeco-demo/src/cz/cuni/mff/d3s/deeco/demo/convoytut/LeaderA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package cz.cuni.mff.d3s.deeco.demo.convoytut; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import cz.cuni.mff.d3s.deeco.annotations.In; | ||
import cz.cuni.mff.d3s.deeco.annotations.InOut; | ||
import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling; | ||
import cz.cuni.mff.d3s.deeco.annotations.Process; | ||
import cz.cuni.mff.d3s.deeco.knowledge.Component; | ||
|
||
public class LeaderA extends Component { | ||
|
||
public String name; | ||
public List<Waypoint> path; | ||
public Waypoint position; | ||
|
||
public LeaderA() { | ||
path = new LinkedList<Waypoint>(); | ||
path.add(new Waypoint(8, 7)); path.add(new Waypoint(8, 6)); path.add(new Waypoint(8, 5)); | ||
path.add(new Waypoint(7, 5)); path.add(new Waypoint(6, 5)); path.add(new Waypoint(5, 5)); | ||
path.add(new Waypoint(4, 5)); path.add(new Waypoint(3, 5)); path.add(new Waypoint(2, 5)); | ||
path.add(new Waypoint(1, 5)); path.add(new Waypoint(0, 5)); path.add(new Waypoint(0, 4)); | ||
path.add(new Waypoint(0, 3)); path.add(new Waypoint(0, 2)); path.add(new Waypoint(1, 2)); | ||
path.add(new Waypoint(2, 2)); path.add(new Waypoint(3, 2)); path.add(new Waypoint(4, 2)); | ||
path.add(new Waypoint(5, 2)); path.add(new Waypoint(6, 2)); path.add(new Waypoint(7, 2)); | ||
path.add(new Waypoint(8, 2)); path.add(new Waypoint(9, 2)); path.add(new Waypoint(9, 1)); | ||
path.add(new Waypoint(9, 0)); | ||
|
||
name = "L1"; | ||
position = new Waypoint(8,8); | ||
} | ||
|
||
@Process | ||
@PeriodicScheduling(1000) | ||
public static void moveProcess( | ||
@InOut("path") List<Waypoint> path, | ||
@In("name") String name, | ||
@InOut("position") Waypoint me | ||
) { | ||
|
||
if (!path.isEmpty() && me.equals(path.get(0))) { | ||
path.remove(0); | ||
} | ||
|
||
if (!path.isEmpty()) { | ||
Waypoint next = path.get(0); | ||
me.x += Integer.signum(next.x - me.x); | ||
me.y += Integer.signum(next.y - me.y); | ||
} | ||
|
||
System.out.println("Leader " + name + ": " + me); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
jdeeco-demo/src/cz/cuni/mff/d3s/deeco/demo/convoytut/LeaderB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package cz.cuni.mff.d3s.deeco.demo.convoytut; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import cz.cuni.mff.d3s.deeco.annotations.In; | ||
import cz.cuni.mff.d3s.deeco.annotations.InOut; | ||
import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling; | ||
import cz.cuni.mff.d3s.deeco.annotations.Process; | ||
import cz.cuni.mff.d3s.deeco.knowledge.Component; | ||
|
||
public class LeaderB extends Component { | ||
|
||
public String name; | ||
public List<Waypoint> path; | ||
public Waypoint position; | ||
|
||
public LeaderB() { | ||
path = new LinkedList<Waypoint>(); | ||
path.add(new Waypoint(1, 1)); | ||
path.add(new Waypoint(1, 2)); | ||
path.add(new Waypoint(1, 3)); | ||
path.add(new Waypoint(2, 3)); | ||
path.add(new Waypoint(3, 3)); | ||
path.add(new Waypoint(4, 3)); | ||
path.add(new Waypoint(5, 3)); | ||
path.add(new Waypoint(6, 3)); | ||
path.add(new Waypoint(6, 4)); | ||
path.add(new Waypoint(6, 5)); | ||
path.add(new Waypoint(6, 6)); | ||
path.add(new Waypoint(6, 7)); | ||
path.add(new Waypoint(6, 8)); | ||
path.add(new Waypoint(7, 8)); | ||
path.add(new Waypoint(8, 8)); | ||
name = "L2"; | ||
position = new Waypoint(1,0); | ||
} | ||
|
||
@Process | ||
@PeriodicScheduling(1000) | ||
public static void moveProcess( | ||
@InOut("path") List<Waypoint> path, | ||
@In("name") String name, | ||
@InOut("position") Waypoint me | ||
) { | ||
|
||
if (!path.isEmpty() && me.equals(path.get(0))) { | ||
path.remove(0); | ||
} | ||
|
||
if (!path.isEmpty()) { | ||
Waypoint next = path.get(0); | ||
me.x += Integer.signum(next.x - me.x); | ||
me.y += Integer.signum(next.y - me.y); | ||
} | ||
|
||
System.out.println("Leader " + name + ": " + me); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.