]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java
3 The file is used to define Tool Chain Configuration Vector
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
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.
15 package org
.tianocore
.frameworkwizard
.common
.Identifications
;
17 import java
.io
.BufferedReader
;
18 import java
.io
.FileNotFoundException
;
19 import java
.io
.FileReader
;
20 import java
.io
.IOException
;
21 import java
.util
.Vector
;
23 public class ToolChainConfigVector
{
25 private Vector
<ToolChainConfigId
> vToolChainConfigs
= new Vector
<ToolChainConfigId
>();
27 public int findToolChainConfigs(ToolChainConfigId sfi
) {
28 for (int index
= 0; index
< vToolChainConfigs
.size(); index
++) {
29 if (vToolChainConfigs
.elementAt(index
).equals(sfi
)) {
36 public int findToolChainConfigs(String name
) {
37 for (int index
= 0; index
< vToolChainConfigs
.size(); index
++) {
38 if (vToolChainConfigs
.elementAt(index
).getName().equals(name
)) {
45 public ToolChainConfigId
getToolChainConfigs(int index
) {
47 return vToolChainConfigs
.elementAt(index
);
53 public Vector
<String
> toStringVector(int index
) {
54 Vector
<String
> v
= new Vector
<String
>();
55 v
.addElement(getToolChainConfigs(index
).getName());
56 v
.addElement(getToolChainConfigs(index
).getValue());
60 public void addToolChainConfigs(ToolChainConfigId arg0
) {
61 vToolChainConfigs
.addElement(arg0
);
64 public void updateToolChainConfigs(ToolChainConfigId arg0
, int arg1
) {
65 vToolChainConfigs
.setElementAt(arg0
, arg1
);
68 public void removeToolChainConfigs(ToolChainConfigId arg0
) {
69 int index
= findToolChainConfigs(arg0
);
71 vToolChainConfigs
.removeElementAt(index
);
75 public void removeToolChainConfigs(int index
) {
76 if (index
> -1 && index
< this.size()) {
77 vToolChainConfigs
.removeElementAt(index
);
81 public void removeAll() {
82 vToolChainConfigs
= new Vector
<ToolChainConfigId
>();
85 public Vector
<String
> getToolChainConfigsName() {
86 Vector
<String
> v
= new Vector
<String
>();
87 for (int index
= 0; index
< this.vToolChainConfigs
.size(); index
++) {
88 v
.addElement(vToolChainConfigs
.get(index
).getName());
93 public Vector
<String
> getToolChainConfigsValue() {
94 Vector
<String
> v
= new Vector
<String
>();
95 for (int index
= 0; index
< this.vToolChainConfigs
.size(); index
++) {
96 v
.addElement(vToolChainConfigs
.get(index
).getValue());
102 return this.vToolChainConfigs
.size();
109 @throws FileNotFoundException
112 public void parseFile(String file
) throws IOException
{
113 FileReader fr
= new FileReader(file
);
114 BufferedReader br
= new BufferedReader(fr
);
115 String line
= br
.readLine();
116 while (line
!= null) {
118 line
= br
.readLine();
123 Parse the input string and add name, value to vector
128 private void parseLine(String line
) {
131 if (line
.indexOf(ToolChainConfigId
.COMMENTS
) != 0 && line
.indexOf(ToolChainConfigId
.EQUALS
) > -1) {
132 name
= line
.substring(0, line
.indexOf(ToolChainConfigId
.EQUALS
)).trim();
133 value
= line
.substring(line
.indexOf(ToolChainConfigId
.EQUALS
) + 1).trim();
134 this.addToolChainConfigs(new ToolChainConfigId(name
, value
));