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