-
Notifications
You must be signed in to change notification settings - Fork 0
/
FollowerLeaderEnsemble.java
51 lines (38 loc) · 1.33 KB
/
FollowerLeaderEnsemble.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package ACC;
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 FollowerLeaderEnsemble extends Ensemble {
@Membership
public static boolean membership(
@In("coord.fLPos") Double fLPos,
@In("coord.fLSpeed") Double fLSpeed,
@In("coord.fLCreationTime") Double fLCreationTime,
@In("coord.fHeadwayDistance") Double fHeadwayDistance,
@In("member.lPos") Double lPos,
@In("member.lSpeed") Double lSpeed,
@In("member.lCreationTime") Double lCreationTime
){
// if( (fLPos - lPos) <= 2*fHeadwayDistance )
return true;
// return false;
}
@KnowledgeExchange
@PeriodicScheduling(50)
public static void map(
@Out("coord.fLPos") OutWrapper<Double> fLPos,
@Out("coord.fLSpeed") OutWrapper<Double> fLSpeed,
@Out("coord.fLCreationTime") OutWrapper<Double> fLCreationTime,
@In("member.lPos") Double lPos,
@In("member.lSpeed") Double lSpeed,
@In("member.lCreationTime") Double lCreationTime
) {
fLPos.value = lPos;
fLSpeed.value = lSpeed;
fLCreationTime.value = lCreationTime;
}
}