Skip to content

Package: Controller

Controller

nameinstructionbranchcomplexitylinemethod
Controller()
M: 23 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
addToBulidingPhase(BuildingPhase)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
addToCheckingConditionPhase(CheckingConditionPhase)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
addToDissolvingPhase(ResolvingPhase)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
addToExtendingPhase(ExtendingPhase)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
start()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
startBuilding()
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
startChecking()
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
startExtending()
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
startResolving()
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package controller;
2:
3: import java.io.IOException;
4: import java.util.ArrayList;
5: import java.util.List;
6:
7: import model.type.TypeDoesNotExistException;
8: import model.type.TypeExceptions;
9: import parser.ParserException;
10: import reader.ReaderException;
11: import scanner.ScannerException;
12:
13: /**
14: *
15: */
16:
17: /**
18: * Represents the Controller as Singleton.
19: *
20: * @author Hendrik
21: *
22: */
23: public final class Controller {
24:         /**
25:          * Building phases.
26:          */
27:         private final List<BuildingPhase> buildingPhase;
28:         /**
29:          * Dissolving phases.
30:          */
31:         private final List<ResolvingPhase> resolvingPhase;
32:         /**
33:          * Initializes the type expansions.
34:          */
35:         private final List<ExtendingPhase> extendingPhase;
36:         /**
37:          * Initializes the flag of the type extensions with the correct value.
38:          */
39:         private final List<CheckingConditionPhase> checkingConditionPhase;
40:
41:         /**
42:          * Creates a Controller.
43:          */
44:         public Controller() {
45:                 super();
46:                 this.buildingPhase = new ArrayList<BuildingPhase>();
47:                 this.resolvingPhase = new ArrayList<ResolvingPhase>();
48:                 this.extendingPhase = new ArrayList<ExtendingPhase>();
49:                 this.checkingConditionPhase = new ArrayList<CheckingConditionPhase>();
50:         }
51:
52:         /**
53:          * @param buildPhase
54:          * Add to building phase.
55:          */
56:         public void addToBulidingPhase(final BuildingPhase buildPhase) {
57:                 this.buildingPhase.add(buildPhase);
58:
59:         }
60:
61:         /**
62:          * @param dissolvePhase
63:          * Add to dissolving phase.
64:          */
65:         public void addToDissolvingPhase(final ResolvingPhase dissolvePhase) {
66:                 this.resolvingPhase.add(dissolvePhase);
67:         }
68:
69:         /**
70:          * @param extendPhase
71:          * Add to extending phase.
72:          */
73:         public void addToExtendingPhase(final ExtendingPhase extendPhase) {
74:                 this.extendingPhase.add(extendPhase);
75:         }
76:
77:         /**
78:          * @param checkPhase
79:          * Add to checking condition phase.
80:          */
81:         public void addToCheckingConditionPhase(final CheckingConditionPhase checkPhase) {
82:                 this.checkingConditionPhase.add(checkPhase);
83:         }
84:
85:         /**
86:          * Start function.
87:          *
88:          * @throws TypeDoesNotExistException
89:          * a
90:          * @throws ParserException
91:          * a
92:          * @throws ReaderException
93:          * a
94:          * @throws IOException
95:          * a
96:          * @throws InterruptedException
97:          * a
98:          * @throws ScannerException
99:          * a
100:          * @throws TypeExceptions
101:          * a
102:          */
103:         public void start() throws TypeDoesNotExistException, ScannerException, InterruptedException,
104:                         IOException, ReaderException, ParserException, TypeExceptions {
105:                 startBuilding();
106:                 startExtending();
107:                 startResolving();
108:                 startChecking();
109:         }
110:
111:         /**
112:          *
113:          * @throws ScannerException
114:          * a
115:          * @throws InterruptedException
116:          * a
117:          * @throws IOException
118:          * a
119:          * @throws ReaderException
120:          * a
121:          * @throws ParserException
122:          * a
123:          */
124:         private void startBuilding() throws ScannerException, InterruptedException, IOException,
125:                         ReaderException, ParserException {
126:                 final java.util.Iterator<BuildingPhase> i = this.buildingPhase.iterator();
127:•                while (i.hasNext()) {
128:                         i.next().action();
129:                 }
130:
131:         }
132:
133:         /**
134:          * Starts dissolving.
135:          *
136:          * @throws TypeDoesNotExistException
137:          * a
138:          * @throws TypeExceptions
139:          * a
140:          */
141:         private void startResolving() throws TypeDoesNotExistException, TypeExceptions {
142:                 final java.util.Iterator<ResolvingPhase> i = this.resolvingPhase.iterator();
143:•                while (i.hasNext()) {
144:                         i.next().action();
145:                 }
146:         }
147:
148:         /**
149:          * Starts extending.
150:          *
151:          * @throws TypeDoesNotExistException
152:          * a
153:          * @throws TypeExceptions
154:          * a
155:          */
156:         private void startExtending() throws TypeDoesNotExistException, TypeExceptions {
157:                 final java.util.Iterator<ExtendingPhase> i = this.extendingPhase.iterator();
158:•                while (i.hasNext()) {
159:                         i.next().action();
160:                 }
161:         }
162:
163:         /**
164:          * Starts checking.
165:          *
166:          * @throws TypeDoesNotExistException
167:          * a
168:          * @throws TypeExceptions
169:          * a
170:          */
171:         private void startChecking() throws TypeDoesNotExistException, TypeExceptions {
172:                 final java.util.Iterator<CheckingConditionPhase> i =
173:                                 this.checkingConditionPhase.iterator();
174:•                while (i.hasNext()) {
175:                         i.next().action();
176:                 }
177:         }
178:
179: }