KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > launching > SootConfiguration


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package ca.mcgill.sable.soot.launching;
21
22 import java.util.*;
23
24 public class SootConfiguration {
25
26
27     private Vector children;
28     private String JavaDoc label;
29     private SootConfiguration parent;
30     
31     /**
32      * Constructor for SootConfiguration.
33      */

34     public SootConfiguration(HashMap aliasValPairs, String JavaDoc name) {
35         super();
36         setAliasValPairs(aliasValPairs);
37         setName(name);
38     }
39     
40     public SootConfiguration(String JavaDoc label) {
41         setLabel(label);
42     }
43     
44     private HashMap aliasValPairs;
45     private String JavaDoc name;
46
47     public void addChild(SootConfiguration t) {
48         if (getChildren() == null) {
49             setChildren(new Vector());
50         }
51         t.setParent(this);
52         getChildren().add(t);
53     }
54     
55     public void removeChild(String JavaDoc name) {
56         Iterator it = getChildren().iterator();
57         SootConfiguration toRemove = null;
58         while (it.hasNext()) {
59             SootConfiguration temp = (SootConfiguration)it.next();
60             if (temp.getLabel().equals(name)) {
61                 toRemove = temp;
62             }
63         }
64         if (toRemove != null) {
65             getChildren().remove(toRemove);
66         }
67     }
68
69     public void renameChild(String JavaDoc oldName, String JavaDoc newName){
70         Iterator it = getChildren().iterator();
71         while (it.hasNext()){
72             SootConfiguration temp = (SootConfiguration)it.next();
73             if (temp.getLabel().equals(oldName)){
74                 temp.setLabel(newName);
75             }
76         }
77     }
78     
79     /**
80      * Returns the aliasValPairs.
81      * @return HashMap
82      */

83     public HashMap getAliasValPairs() {
84         return aliasValPairs;
85     }
86
87     /**
88      * Returns the name.
89      * @return String
90      */

91     public String JavaDoc getName() {
92         return name;
93     }
94
95     /**
96      * Sets the aliasValPairs.
97      * @param aliasValPairs The aliasValPairs to set
98      */

99     public void setAliasValPairs(HashMap aliasValPairs) {
100         this.aliasValPairs = aliasValPairs;
101     }
102
103     /**
104      * Sets the name.
105      * @param name The name to set
106      */

107     public void setName(String JavaDoc name) {
108         this.name = name;
109     }
110
111     /**
112      * Returns the children.
113      * @return Vector
114      */

115     public Vector getChildren() {
116         return children;
117     }
118
119     /**
120      * Returns the label.
121      * @return String
122      */

123     public String JavaDoc getLabel() {
124         return label;
125     }
126
127     /**
128      * Returns the parent.
129      * @return SootConfiguration
130      */

131     public SootConfiguration getParent() {
132         return parent;
133     }
134
135     /**
136      * Sets the children.
137      * @param children The children to set
138      */

139     public void setChildren(Vector children) {
140         this.children = children;
141     }
142
143     /**
144      * Sets the label.
145      * @param label The label to set
146      */

147     public void setLabel(String JavaDoc label) {
148         this.label = label;
149     }
150
151     /**
152      * Sets the parent.
153      * @param parent The parent to set
154      */

155     public void setParent(SootConfiguration parent) {
156         this.parent = parent;
157     }
158
159 }
160
Popular Tags