00001 package edu.ksu.cis.bandera.specification.datastructure;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 import java.util.*;
00036 import ca.mcgill.sable.soot.*;
00037 import edu.ksu.cis.bandera.jjjc.symboltable.Package;
00038 import edu.ksu.cis.bandera.jjjc.symboltable.*;
00039 import edu.ksu.cis.bandera.specification.assertion.datastructure.*;
00040 import edu.ksu.cis.bandera.specification.predicate.datastructure.*;
00041
00042
00043 public class Property {
00044 private String filename = "";
00045 private TreeSet importedType = new TreeSet();
00046 private TreeSet importedPackage = new TreeSet();
00047 private TreeSet importedPredicate = new TreeSet();
00048 private TreeSet importedPredicateSet = new TreeSet();
00049 private TreeSet importedAssertion = new TreeSet();
00050 private TreeSet importedAssertionSet = new TreeSet();
00051 private Hashtable assertionPropertyTable = new Hashtable();
00052 private TreeSet activatedAssertionProperty = new TreeSet();
00053 private Hashtable temporalLogicPropertyTable = new Hashtable();
00054 private TemporalLogicProperty activatedTemporalLogicProperty;
00055
00056
00057
00058
00059 public void activateOrDeactivateAssertionProperty(AssertionProperty ap) {
00060 if (!activatedAssertionProperty.contains(ap)) {
00061 activatedAssertionProperty.add(ap);
00062 } else {
00063 activatedAssertionProperty.remove(ap);
00064 }
00065 }
00066
00067
00068
00069
00070 public void activateOrDeactivateTemporalLogicProperty(TemporalLogicProperty tlp) {
00071 if (tlp == activatedTemporalLogicProperty)
00072 activatedTemporalLogicProperty = null;
00073 else
00074 activatedTemporalLogicProperty = tlp;
00075 }
00076
00077
00078
00079
00080 public void addAssertionProperty(AssertionProperty ap) {
00081 assertionPropertyTable.put(ap.getName(), ap);
00082 }
00083
00084
00085
00086
00087 public void addTemporalLogicProperty(TemporalLogicProperty tlp) {
00088 temporalLogicPropertyTable.put(tlp.getName(), tlp);
00089 }
00090
00091
00092
00093
00094 public TreeSet getActivatedAssertionProperties() {
00095 return activatedAssertionProperty;
00096 }
00097
00098
00099
00100
00101 public TemporalLogicProperty getActivatedTemporalLogicProperty() {
00102 return activatedTemporalLogicProperty;
00103 }
00104
00105
00106
00107
00108 public Vector getAssertionProperties() {
00109 TreeSet ts = new TreeSet();
00110 for (Enumeration e = assertionPropertyTable.elements(); e.hasMoreElements();) {
00111 ts.add(e.nextElement());
00112 }
00113 return new Vector(ts);
00114 }
00115
00116
00117
00118
00119
00120 public AssertionProperty getAssertionProperty(String name) {
00121 return (AssertionProperty) assertionPropertyTable.get(name);
00122 }
00123
00124
00125
00126
00127 public java.lang.String getFilename() {
00128 return filename;
00129 }
00130
00131
00132
00133
00134 public java.util.TreeSet getImportedAssertion() {
00135 return importedAssertion;
00136 }
00137
00138
00139
00140
00141 public java.util.TreeSet getImportedAssertionSet() {
00142 return importedAssertionSet;
00143 }
00144
00145
00146
00147
00148 public java.util.TreeSet getImportedPackage() {
00149 return importedPackage;
00150 }
00151
00152
00153
00154
00155 public java.util.TreeSet getImportedPredicate() {
00156 return importedPredicate;
00157 }
00158
00159
00160
00161
00162 public java.util.TreeSet getImportedPredicateSet() {
00163 return importedPredicateSet;
00164 }
00165
00166
00167
00168
00169 public java.util.TreeSet getImportedType() {
00170 return importedType;
00171 }
00172
00173
00174
00175
00176 public Vector getTemporalLogicProperties() {
00177 TreeSet ts = new TreeSet();
00178 for (Enumeration e = temporalLogicPropertyTable.elements(); e.hasMoreElements();) {
00179 ts.add(e.nextElement());
00180 }
00181 return new Vector(ts);
00182 }
00183
00184
00185
00186
00187
00188 public TemporalLogicProperty getTemporalLogicProperty(String name) {
00189 return (TemporalLogicProperty) temporalLogicPropertyTable.get(name);
00190 }
00191
00192
00193
00194
00195
00196 public boolean hasAssertionProperty(String name) {
00197 return assertionPropertyTable.get(name) != null;
00198 }
00199
00200
00201
00202
00203
00204 public boolean hasTemporalLogicProperty(String name) {
00205 return temporalLogicPropertyTable.get(name) != null;
00206 }
00207
00208
00209
00210
00211 public void importAssertion(Name name) {
00212 importedAssertion.add(name);
00213 }
00214
00215
00216
00217
00218 public void importAssertionSet(Name name) {
00219 importedAssertionSet.add(name);
00220 }
00221
00222
00223
00224
00225 public void importPackage(Name name) {
00226 importedPackage.add(name);
00227 }
00228
00229
00230
00231
00232 public void importPredicate(Name name) {
00233 importedPredicate.add(name);
00234 }
00235
00236
00237
00238
00239 public void importPredicateSet(Name name) {
00240 importedPredicateSet.add(name);
00241 }
00242
00243
00244
00245
00246 public void importType(Name name) {
00247 importedType.add(name);
00248 }
00249
00250
00251
00252
00253
00254 public boolean isActivated(AssertionProperty ap) {
00255 return activatedAssertionProperty.contains(ap);
00256 }
00257
00258
00259
00260
00261
00262 public boolean isActivated(TemporalLogicProperty tlp) {
00263 return activatedTemporalLogicProperty == tlp;
00264 }
00265
00266
00267
00268
00269 public void removeAssertionProperty(AssertionProperty ap) {
00270 for (Enumeration e = assertionPropertyTable.keys(); e.hasMoreElements();) {
00271 Object key = e.nextElement();
00272 Object value = assertionPropertyTable.get(key);
00273 if (value == ap) {
00274 assertionPropertyTable.remove(key);
00275 break;
00276 }
00277 }
00278 activatedAssertionProperty.remove(ap);
00279 }
00280
00281
00282
00283
00284 public void removeImportedAssertion(Name name) {
00285 importedAssertion.remove(name);
00286 }
00287
00288
00289
00290
00291 public void removeImportedAssertionSet(Name name) {
00292 importedAssertionSet.remove(name);
00293 }
00294
00295
00296
00297
00298 public void removeImportedPackage(Name name) {
00299 importedPackage.remove(name);
00300 }
00301
00302
00303
00304
00305 public void removeImportedPredicate(Name name) {
00306 importedPredicate.remove(name);
00307 }
00308
00309
00310
00311
00312 public void removeImportedPredicateSet(Name name) {
00313 importedPredicateSet.remove(name);
00314 }
00315
00316
00317
00318
00319 public void removeImportedType(Name name) {
00320 importedType.remove(name);
00321 }
00322
00323
00324
00325
00326 public void removeTemporalLogicProperty(TemporalLogicProperty tlp) {
00327 for (Enumeration e = temporalLogicPropertyTable.keys(); e.hasMoreElements();) {
00328 Object key = e.nextElement();
00329 Object value = temporalLogicPropertyTable.get(key);
00330 if (value == tlp) {
00331 temporalLogicPropertyTable.remove(key);
00332 break;
00333 }
00334 }
00335 if (activatedTemporalLogicProperty == tlp)
00336 activatedTemporalLogicProperty = null;
00337 }
00338
00339
00340
00341
00342 public void setFilename(java.lang.String newFilename) {
00343 filename = newFilename;
00344 }
00345 }