Skip to content

Package: ScanAndParseAssignmentFile

ScanAndParseAssignmentFile

nameinstructionbranchcomplexitylinemethod
ScanAndParseAssignmentFile(ConfiguredPackage, File, RouterConfiguration)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
action()
M: 36 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: *
3: */
4: package controller.buildingphase;
5:
6: import java.io.File;
7: import java.io.FileInputStream;
8: import java.io.IOException;
9:
10: import basic.Buffer;
11: import controller.BuildingPhase;
12: import model.ConfiguredPackage;
13: import model.RouterConfiguration;
14: import model.assignment.AssignmentFile;
15: import parser.AssignmentFileParser;
16: import parser.ParserException;
17: import reader.ReaderException;
18: import scanner.AssignmentFileScanner;
19: import scanner.ScannerException;
20: import symbols.AbstractSymbol;
21:
22: /**
23: * @author Hendrik
24: *
25: */
26: public class ScanAndParseAssignmentFile extends BuildingPhase {
27:         /**
28:          * The associated package.
29:          */
30:         private final ConfiguredPackage pkg;
31:         /**
32:          * The path to the assignment file.
33:          */
34:         private final File assignmentFile;
35:         /**
36:          * Reference of RouterConfiguration.
37:          */
38:         private final RouterConfiguration routerConfiguration;
39:
40:         /**
41:          * Constructor. No side effects.
42:          *
43:          * @param pkg
44:          * The associated package.
45:          * @param assignmentFile
46:          * the path to the assignment file.
47:          * @param routerConfiguration
48:          * Reference to the RouterConfiguration.
49:          */
50:         public ScanAndParseAssignmentFile(final ConfiguredPackage pkg, final File assignmentFile,
51:                         final RouterConfiguration routerConfiguration) {
52:                 super();
53:                 this.pkg = pkg;
54:                 this.assignmentFile = assignmentFile;
55:                 this.routerConfiguration = routerConfiguration;
56:         }
57:
58:         @Override
59:         public void action() throws ScannerException, InterruptedException, IOException,
60:                         ReaderException, ParserException {
61:                 final Buffer<AbstractSymbol> assignmentBuffer = new Buffer<AbstractSymbol>(10000000);
62:                 AssignmentFileScanner.toSymbolSequence(new FileInputStream(assignmentFile.getPath()),
63:                                 assignmentFile.getPath(), assignmentBuffer);
64:                 final AssignmentFile aF =
65:                                 new AssignmentFileParser(this.pkg.getRouterConfiguration(), assignmentBuffer)
66:                                                 .getAssignmentFile();
67:                 pkg.setAssignmentFile(aF);
68:                 routerConfiguration.getAssignmentFileManager().add(aF);
69:         }
70: }