]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java
Use table and popup window to add/edit all elements of module instead of original...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / Identifications / Externs / ExternsVector.java
1 /** @file
2
3 The file is used to define Package Dependencies 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.Externs;
16
17 import java.util.Vector;
18
19 import org.tianocore.frameworkwizard.common.EnumerationData;
20
21 public class ExternsVector {
22
23 private Vector<ExternsIdentification> vExterns = new Vector<ExternsIdentification>();
24
25 public int findExterns(ExternsIdentification sfi) {
26 for (int index = 0; index < vExterns.size(); index++) {
27 if (vExterns.elementAt(index).equals(sfi)) {
28 return index;
29 }
30 }
31 return -1;
32 }
33
34 public int findExterns(String name) {
35 for (int index = 0; index < vExterns.size(); index++) {
36 if (vExterns.elementAt(index).getName().equals(name)) {
37 return index;
38 }
39 }
40 return -1;
41 }
42
43 public ExternsIdentification getExterns(int index) {
44 if (index > -1) {
45 return vExterns.elementAt(index);
46 } else {
47 return null;
48 }
49 }
50
51 public void addExterns(ExternsIdentification arg0) {
52 boolean isExistPcd = false;
53 if (arg0.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
54 for (int index = 0; index < size(); index++) {
55 if (getExterns(index).getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
56 setExterns(arg0, index);
57 isExistPcd = true;
58 break;
59 }
60 }
61 if (!isExistPcd) {
62 vExterns.addElement(arg0);
63 }
64 } else {
65 vExterns.addElement(arg0);
66 }
67 }
68
69 public void setExterns(ExternsIdentification arg0, int arg1) {
70 vExterns.setElementAt(arg0, arg1);
71 }
72
73 public void removeExterns(ExternsIdentification arg0) {
74 int index = findExterns(arg0);
75 if (index > -1) {
76 vExterns.removeElementAt(index);
77 }
78 }
79
80 public void removeExterns(int index) {
81 if (index > -1 && index < this.size()) {
82 vExterns.removeElementAt(index);
83 }
84 }
85
86 public Vector<ExternsIdentification> getvExterns() {
87 return vExterns;
88 }
89
90 public void setvExterns(Vector<ExternsIdentification> Externs) {
91 vExterns = Externs;
92 }
93
94 public Vector<String> getExternsName() {
95 Vector<String> v = new Vector<String>();
96 for (int index = 0; index < this.vExterns.size(); index++) {
97 v.addElement(vExterns.get(index).getName());
98 }
99 return v;
100 }
101
102 public int size() {
103 return this.vExterns.size();
104 }
105
106 public Vector<String> toStringVector(int index) {
107 Vector<String> v = new Vector<String>();
108 v.addElement(getExterns(index).getName());
109 v.addElement(getExterns(index).getType());
110 return v;
111 }
112 }