]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java
1. Enhance Source Files selection in msa:
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / Identifications / SourceFiles / SourceFilesVector.java
CommitLineData
a13899c5 1/** @file\r
2 \r
3 The file is used to define Source Files 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
15\r
79cb6fdb 16package org.tianocore.frameworkwizard.module.Identifications.SourceFiles;\r
a13899c5 17\r
18import java.util.Vector;\r
19\r
20public class SourceFilesVector {\r
21 private Vector<SourceFilesIdentification> vSourceFiles = new Vector<SourceFilesIdentification>();\r
22\r
23 public int findSourceFiles(SourceFilesIdentification sfi) {\r
24 for (int index = 0; index < vSourceFiles.size(); index++) {\r
25 if (vSourceFiles.elementAt(index).equals(sfi)) {\r
26 return index;\r
27 }\r
28 }\r
29 return -1;\r
30 }\r
31\r
32 public int findSourceFiles(String name) {\r
33 for (int index = 0; index < vSourceFiles.size(); index++) {\r
34 if (vSourceFiles.elementAt(index).getFilename().equals(name)) {\r
35 return index;\r
36 }\r
37 }\r
38 return -1;\r
39 }\r
40\r
41 public SourceFilesIdentification getSourceFiles(int index) {\r
42 if (index > -1) {\r
43 return vSourceFiles.elementAt(index);\r
44 } else {\r
45 return null;\r
46 }\r
47 }\r
48\r
49 public void addSourceFiles(SourceFilesIdentification sfi) {\r
2003a22e 50 if (findSourceFiles(sfi) == -1) {\r
51 vSourceFiles.addElement(sfi);\r
52 }\r
a13899c5 53 }\r
54\r
06a19cee 55 public void setSourceFiles(SourceFilesIdentification sfi, int index) {\r
a13899c5 56 vSourceFiles.setElementAt(sfi, index);\r
57 }\r
58\r
59 public void removeSourceFiles(SourceFilesIdentification sfi) {\r
60 int index = findSourceFiles(sfi);\r
61 if (index > -1) {\r
62 vSourceFiles.removeElementAt(index);\r
63 }\r
64 }\r
65\r
66 public void removeSourceFiles(int index) {\r
67 if (index > -1 && index < this.size()) {\r
68 vSourceFiles.removeElementAt(index);\r
69 }\r
70 }\r
71\r
72 public Vector<SourceFilesIdentification> getvSourceFiles() {\r
73 return vSourceFiles;\r
74 }\r
75\r
76 public void setvSourceFiles(Vector<SourceFilesIdentification> SourceFiles) {\r
77 vSourceFiles = SourceFiles;\r
78 }\r
79 \r
80 public Vector<String> getSourceFilesName() {\r
81 Vector<String> v = new Vector<String>();\r
82 for (int index = 0; index < this.vSourceFiles.size(); index++) {\r
83 v.addElement(vSourceFiles.get(index).getFilename());\r
84 }\r
85 return v;\r
86 }\r
87\r
88 public int size() {\r
89 return this.vSourceFiles.size();\r
90 }\r
06a19cee 91 \r
92 public Vector<String> toStringVector(int index) {\r
93 Vector<String> v = new Vector<String>();\r
94 v.addElement(getSourceFiles(index).getFilename());\r
95 return v;\r
96 }\r
a13899c5 97}\r