1. Fix EDKT230 "A library class should not be specified for a module more than one...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / Identifications / LibraryClass / LibraryClassVector.java
CommitLineData
a13899c5 1/** @file\r
2 \r
3 The file is used to define Library Class Vector\r
4 \r
5 Copyright (c) 2006, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 \r
14 **/\r
79cb6fdb 15package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;\r
a13899c5 16\r
17import java.util.Vector;\r
18\r
19\r
20public class LibraryClassVector {\r
21 private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();\r
22 \r
23 public int findLibraryClass(LibraryClassIdentification lib) {\r
90bed2f7 24 return findLibraryClass(lib.getLibraryClassName());\r
a13899c5 25 }\r
26 \r
27 public int findLibraryClass(String name) {\r
28 for (int index = 0; index < vLibraryClass.size(); index++) {\r
29 if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {\r
30 return index;\r
31 }\r
32 }\r
33 return -1;\r
34 }\r
35 \r
36 public LibraryClassIdentification getLibraryClass(int index) {\r
37 if (index > -1) {\r
38 return vLibraryClass.elementAt(index);\r
39 } else {\r
40 return null;\r
41 }\r
42 }\r
43 \r
44 public void addLibraryClass(LibraryClassIdentification lib) {\r
90bed2f7 45 if (findLibraryClass(lib) == -1) {\r
46 vLibraryClass.addElement(lib);\r
47 }\r
a13899c5 48 }\r
49 \r
06a19cee 50 public void setLibraryClass(LibraryClassIdentification lib, int index) {\r
a13899c5 51 vLibraryClass.setElementAt(lib, index);\r
52 }\r
53 \r
54 public void removeLibraryClass(LibraryClassIdentification lib) {\r
55 int index = findLibraryClass(lib);\r
56 if (index > -1) {\r
57 vLibraryClass.removeElementAt(index);\r
58 }\r
59 }\r
60 \r
61 public void removeLibraryClass(int index) {\r
62 if (index > -1 && index < this.size()) {\r
63 vLibraryClass.removeElementAt(index);\r
64 }\r
65 }\r
66\r
67 public Vector<LibraryClassIdentification> getVLibraryClass() {\r
68 return vLibraryClass;\r
69 }\r
70\r
71 public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {\r
72 vLibraryClass = libraryClass;\r
73 }\r
74 \r
75 public Vector<String> getLibraryClassName() {\r
76 Vector<String> v = new Vector<String>();\r
77 for (int index = 0; index < this.vLibraryClass.size(); index++) {\r
78 v.addElement(vLibraryClass.get(index).getLibraryClassName());\r
79 }\r
80 return v;\r
81 }\r
82 \r
83 public int size() {\r
84 return this.vLibraryClass.size();\r
85 }\r
92e29378 86 \r
87 public Vector<String> toStringVector(int index) {\r
88 Vector<String> v = new Vector<String>();\r
89 v.addElement(getLibraryClass(index).getLibraryClassName());\r
90 v.addElement(getLibraryClass(index).getUsage());\r
91 return v;\r
92 }\r
a13899c5 93}\r