Skip to content

Package: ScanAndParsePackageDescriptionFile

ScanAndParsePackageDescriptionFile

nameinstructionbranchcomplexitylinemethod
ScanAndParsePackageDescriptionFile(Package, File)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
action()
M: 26 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 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 model.Package;
11: import parser.PackageDescriptionFileParser;
12: import parser.ParserException;
13: import reader.ReaderException;
14: import scanner.PackageDescriptionFileScanner;
15: import scanner.ScannerException;
16: import symbols.AbstractSymbol;
17: import basic.Buffer;
18: import controller.BuildingPhase;
19:
20: /**
21: * Scans and parses a package description file.
22: */
23: public class ScanAndParsePackageDescriptionFile extends BuildingPhase {
24:         /**
25:          * The associated package.
26:          */
27:         private final Package pkg;
28:         /**
29:          * The path to the package description file.
30:          */
31:         private final File pkgDescFile;
32:
33:         /**
34:          * Constructor. No side effects.
35:          *
36:          * @param pkg
37:          * The associated package.
38:          * @param pkgDescFile
39:          * the path to the package description file.
40:          */
41:         public ScanAndParsePackageDescriptionFile(final Package pkg, final File pkgDescFile) {
42:                 super();
43:                 this.pkg = pkg;
44:                 this.pkgDescFile = pkgDescFile;
45:         }
46:
47:         @Override
48:         public void action() throws ScannerException, InterruptedException, IOException,
49:                         ReaderException, ParserException {
50:                 final Buffer<AbstractSymbol> pkgDescBuffer = new Buffer<AbstractSymbol>(10000000);
51:                 PackageDescriptionFileScanner.toSymbolSequence(
52:                                 new FileInputStream(pkgDescFile.getPath()), pkgDescFile.getPath(), pkgDescBuffer);
53:                 pkg.setPackageDescriptionFile(PackageDescriptionFileParser.parse(
54:                                 this.pkg.getRouterSoftware(), pkgDescBuffer));
55:         }
56: }