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