]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
1. Fix EDKT303: Give warning if no library instances that support the required the...
[mirror_edk2.git] / Tools / Java / 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
a13899c5 19public class LibraryClassVector {\r
20 private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();\r
a721f5c4 21\r
a13899c5 22 public int findLibraryClass(LibraryClassIdentification lib) {\r
a721f5c4 23 for (int index = 0; index < vLibraryClass.size(); index++) {\r
24 if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())\r
25 && vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {\r
26 return index;\r
27 }\r
28 }\r
29 return -1;\r
a13899c5 30 }\r
a721f5c4 31\r
a13899c5 32 public int findLibraryClass(String name) {\r
33 for (int index = 0; index < vLibraryClass.size(); index++) {\r
34 if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {\r
35 return index;\r
36 }\r
37 }\r
38 return -1;\r
39 }\r
a721f5c4 40\r
a13899c5 41 public LibraryClassIdentification getLibraryClass(int index) {\r
42 if (index > -1) {\r
43 return vLibraryClass.elementAt(index);\r
44 } else {\r
45 return null;\r
46 }\r
47 }\r
a721f5c4 48\r
a13899c5 49 public void addLibraryClass(LibraryClassIdentification lib) {\r
90bed2f7 50 if (findLibraryClass(lib) == -1) {\r
51 vLibraryClass.addElement(lib);\r
52 }\r
a13899c5 53 }\r
a721f5c4 54\r
06a19cee 55 public void setLibraryClass(LibraryClassIdentification lib, int index) {\r
a13899c5 56 vLibraryClass.setElementAt(lib, index);\r
57 }\r
a721f5c4 58\r
a13899c5 59 public void removeLibraryClass(LibraryClassIdentification lib) {\r
60 int index = findLibraryClass(lib);\r
61 if (index > -1) {\r
62 vLibraryClass.removeElementAt(index);\r
63 }\r
64 }\r
a721f5c4 65\r
a13899c5 66 public void removeLibraryClass(int index) {\r
67 if (index > -1 && index < this.size()) {\r
68 vLibraryClass.removeElementAt(index);\r
69 }\r
70 }\r
71\r
72 public Vector<LibraryClassIdentification> getVLibraryClass() {\r
73 return vLibraryClass;\r
74 }\r
75\r
76 public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {\r
77 vLibraryClass = libraryClass;\r
78 }\r
a721f5c4 79\r
a13899c5 80 public Vector<String> getLibraryClassName() {\r
81 Vector<String> v = new Vector<String>();\r
82 for (int index = 0; index < this.vLibraryClass.size(); index++) {\r
83 v.addElement(vLibraryClass.get(index).getLibraryClassName());\r
84 }\r
85 return v;\r
86 }\r
a721f5c4 87\r
a13899c5 88 public int size() {\r
89 return this.vLibraryClass.size();\r
90 }\r
a721f5c4 91\r
92e29378 92 public Vector<String> toStringVector(int index) {\r
93 Vector<String> v = new Vector<String>();\r
94 v.addElement(getLibraryClass(index).getLibraryClassName());\r
95 v.addElement(getLibraryClass(index).getUsage());\r
96 return v;\r
97 }\r
a13899c5 98}\r