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