1
1
package org .openengine .mpn ;
2
2
3
- import org .mpn .Dataset ;
4
- import org .mpn .MatchModel ;
5
- import org .mpn .Processable ;
3
+ import org .mpn .*;
6
4
5
+ import java .util .ArrayList ;
6
+ import java .util .List ;
7
7
import java .util .Random ;
8
8
9
9
public class MatchEventDataGeneration {
10
10
11
+ private static final int DURATION = 60 * 45 ; // duration in seconds
12
+
11
13
private Dataset seedMatchEvents ;
12
14
private Dataset generatedMatchEvents ;
13
15
16
+ private List <ProcessUnit > matchEventsBuffer = new ArrayList <>();
17
+
14
18
private Random rnd = new Random ();
15
19
16
20
private Team homeTeam ;
@@ -33,14 +37,37 @@ public static void main(String[] args) {
33
37
}
34
38
35
39
public void out () {
36
- System .out .println (possessionTeam );
40
+ this .generatedMatchEvents = new Dataset (matchEventsBuffer , true );
41
+ this .generatedMatchEvents .getData ().forEach (System .out ::println );
37
42
}
38
43
39
44
public void generate () {
40
45
// TODO implement generating of match events
41
46
// refactoring of the start() method of MatchEngine class
42
47
43
48
tossCoin ();
49
+ playTimePeriod (DURATION );
50
+ }
51
+
52
+ private void registerTransition (MatchPhaseTransition transition ) {
53
+ this .matchEventsBuffer .add ((Statement ) transition );
54
+ }
55
+
56
+ private void playTimePeriod (int duration ) {
57
+ MatchPhaseTransition currentTransition = getKickOffPhaseTransition ();
58
+ registerTransition (currentTransition );
59
+ // processTransition(currentTransition);
60
+ /*
61
+ while (currentTime < duration) {
62
+ currentTransition = getNextTransition(currentTransition);
63
+ processTransition(currentTransition);
64
+ }
65
+ */
66
+ }
67
+
68
+ private MatchPhaseTransition getKickOffPhaseTransition () {
69
+ Dataset potentialTransitions = possessionTeam .getActionsByState (State .KICK_OFF );
70
+ return potentialTransitions .getAny ();
44
71
}
45
72
46
73
private void tossCoin () {
0 commit comments