Skip to content

Package: LibManager

LibManager

nameinstructionbranchcomplexitylinemethod
LibManager()
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%
addModule(Module)
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
containsModule(Module)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
containsModule(String)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createReader(ArchiveGenerator, File)
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getSONames()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSoName(String)
M: 21 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getTheInstance()
M: 8 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: *
3: */
4: package libraries;
5:
6: import java.io.File;
7: import java.io.IOException;
8: import java.util.ArrayList;
9: import java.util.HashMap;
10: import java.util.List;
11: import java.util.Map;
12:
13: import generator.ArchiveGenerator;
14:
15: /**
16: * @author Hendrik
17: *
18: */
19: public final class LibManager {
20:         /**
21:          * Map of SONames.
22:          */
23:         private final Map<String, SOName> soNames;
24:         /**
25:          * List of Files.
26:          */
27:         private final List<File> files;
28:         /**
29:          * Map of Modules.
30:          */
31:         private final Map<String, Module> modules;
32:         /**
33:          * List of all LibReaders.
34:          */
35:         private final List<LibReader> reader;
36:
37:         /**
38:         *
39:         */
40:         private LibManager() {
41:                 super();
42:                 this.soNames = new HashMap<String, SOName>();
43:                 this.files = new ArrayList<File>();
44:                 this.reader = new ArrayList<LibReader>();
45:                 this.modules = new HashMap<String, Module>();
46:         }
47:
48:         /**
49:          * theInstance of an ModMgr for the singleton.
50:          */
51:
52:         private static LibManager instance;
53:
54:         /**
55:          * @return the PackageManager.
56:          *
57:          */
58:         public static LibManager getTheInstance() {
59:•                if (LibManager.instance == null) {
60:
61:                         LibManager.instance = new LibManager();
62:
63:                 }
64:                 return instance;
65:         }
66:
67:         /**
68:          * creates the Lib Reader.
69:          *
70:          * @param gen
71:          * the {@link ArchiveGenerator} to use
72:          * @param file
73:          * to read.
74:          * @return the reader.
75:          * @throws IOException
76:          * if sth is wrong with the file.
77:          */
78:         public LibReader createReader(final ArchiveGenerator gen, final File file)
79:                         throws IOException {
80:                 final LibReader reader1 = new LibReader(gen, file);
81:                 this.files.add(file);
82:                 this.reader.add(reader1);
83:                 return reader1;
84:         }
85:
86:         /**
87:          * creates an structured Object if it doesn't exists and returns it.
88:          *
89:          * @param value
90:          * the name.
91:          * @return SOName.
92:          */
93:         public SOName getSoName(final String value) {
94:                 SOName soName = this.soNames.get(value);
95:•                if (soName == null) {
96:                         soName = new SOName(value);
97:                         this.soNames.put(value, soName);
98:                 }
99:                 return soName;
100:         }
101:
102:         /**
103:          *
104:          * @return the hole map with SONames.
105:          */
106:         public Map<String, SOName> getSONames() {
107:                 return this.soNames;
108:         }
109:
110:         /**
111:          * add entry in modules.
112:          *
113:          * @param entry
114:          * The entry to add.
115:          */
116:         public void addModule(final Module entry) {
117:•                if (!this.modules.containsValue(entry)) {
118:                         this.modules.put(entry.toString(), entry);
119:                 }
120:
121:         }
122:
123:         /**
124:          * contains Value on modules.
125:          *
126:          * @param entry
127:          * the module
128:          * @return containsValueBoolean
129:          */
130:         public Boolean containsModule(final Module entry) {
131:                 return this.modules.containsValue(entry);
132:         }
133:
134:         /**
135:          * contains Key on modules.
136:          *
137:          * @param entry
138:          * the Key
139:          * @return containsKeyBoolean
140:          */
141:         public Boolean containsModule(final String entry) {
142:                 return this.modules.containsKey(entry);
143:         }
144: }