d5e22f980bab5270a91dfd77387a314d97140077
[mirror_edk2.git] / Tools / 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 for (int index = 0; index < vLibraryClass.size(); index++) {
25 if (vLibraryClass.elementAt(index).equals(lib)) {
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 vLibraryClass.addElement(lib);
51 }
52
53 public void setLibraryClass(LibraryClassIdentification lib, int index) {
54 vLibraryClass.setElementAt(lib, index);
55 }
56
57 public void removeLibraryClass(LibraryClassIdentification lib) {
58 int index = findLibraryClass(lib);
59 if (index > -1) {
60 vLibraryClass.removeElementAt(index);
61 }
62 }
63
64 public void removeLibraryClass(int index) {
65 if (index > -1 && index < this.size()) {
66 vLibraryClass.removeElementAt(index);
67 }
68 }
69
70 public Vector<LibraryClassIdentification> getVLibraryClass() {
71 return vLibraryClass;
72 }
73
74 public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
75 vLibraryClass = libraryClass;
76 }
77
78 public Vector<String> getLibraryClassName() {
79 Vector<String> v = new Vector<String>();
80 for (int index = 0; index < this.vLibraryClass.size(); index++) {
81 v.addElement(vLibraryClass.get(index).getLibraryClassName());
82 }
83 return v;
84 }
85
86 public int size() {
87 return this.vLibraryClass.size();
88 }
89
90 public Vector<String> toStringVector(int index) {
91 Vector<String> v = new Vector<String>();
92 v.addElement(getLibraryClass(index).getLibraryClassName());
93 v.addElement(getLibraryClass(index).getUsage());
94 return v;
95 }
96 }