00001 package edu.ksu.cis.bandera.specification.predicate.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 edu.ksu.cis.bandera.annotation.*;
00037 import edu.ksu.cis.bandera.jjjc.symboltable.*;
00038 import edu.ksu.cis.bandera.specification.predicate.node.*;
00039 import edu.ksu.cis.bandera.specification.predicate.exception.*;
00040 import ca.mcgill.sable.soot.jimple.*;
00041
00042 public abstract class Predicate {
00043 protected static Jimple jimple = Jimple.v();
00044 protected Name name;
00045 protected Node node;
00046 protected Annotation annotation;
00047 protected Vector exceptions;
00048 protected PExp constraint;
00049 protected String description;
00050 protected boolean isStatic;
00051 protected boolean usePrivate;
00052 protected ClassOrInterfaceType type;
00053 protected Hashtable variablesUsed;
00054 protected Vector params;
00055 protected Vector paramTypes;
00056
00057
00058
00059
00060
00061
00062
00063
00064 protected Predicate(Name name, ClassOrInterfaceType type, Annotation annotation, Node node, Vector exceptions) throws DuplicatePredicateException {
00065 this.name = name;
00066 this.annotation = annotation;
00067 this.type = type;
00068 this.node = node;
00069 this.exceptions = exceptions;
00070
00071 Name psName = name.getSuperName();
00072 try {
00073 PredicateSet ps = PredicateSet.getPredicateSet(psName);
00074 ps.putPredicate(this);
00075 } catch (Exception e) {
00076 PredicateSet ps = new PredicateSet(psName);
00077 ps.putPredicate(this);
00078 PredicateSet.putPredicateSet(ps);
00079 }
00080 }
00081
00082
00083
00084
00085 public edu.ksu.cis.bandera.annotation.Annotation getAnnotation() {
00086 return annotation;
00087 }
00088
00089
00090
00091
00092 public edu.ksu.cis.bandera.specification.predicate.node.PExp getConstraint() {
00093 return constraint;
00094 }
00095
00096
00097
00098
00099 public java.lang.String getDescription() {
00100 return description;
00101 }
00102
00103
00104
00105
00106 public java.util.Vector getExceptions() {
00107 return exceptions;
00108 }
00109
00110
00111
00112
00113 public Name getName() {
00114 return name;
00115 }
00116 public Node getNode() { return node; }
00117
00118
00119
00120
00121 public int getNumOfParams() {
00122 return params.size();
00123 }
00124
00125
00126
00127
00128
00129 public String getParam(int index) {
00130 return (String) params.elementAt(index);
00131 }
00132
00133
00134
00135
00136 public java.util.Vector getParams() {
00137 return params;
00138 }
00139
00140
00141
00142
00143
00144 public Type getParamType(int index) {
00145 return (Type) paramTypes.elementAt(index);
00146 }
00147
00148
00149
00150
00151 public java.util.Vector getParamTypes() {
00152 return paramTypes;
00153 }
00154
00155
00156
00157
00158 public edu.ksu.cis.bandera.jjjc.symboltable.ClassOrInterfaceType getType() {
00159 return type;
00160 }
00161
00162
00163
00164
00165 public java.util.Hashtable getVariablesUsed() {
00166 return variablesUsed;
00167 }
00168
00169
00170
00171
00172 public boolean isStatic() {
00173 return isStatic;
00174 }
00175
00176
00177
00178
00179 public boolean isUsePrivate() {
00180 return usePrivate;
00181 }
00182
00183
00184
00185
00186 public boolean isValid() {
00187 return exceptions.size() == 0;
00188 }
00189
00190
00191
00192
00193 public void setConstraint(edu.ksu.cis.bandera.specification.predicate.node.PExp newConstraint) {
00194 constraint = newConstraint;
00195 }
00196
00197
00198
00199
00200 public void setDescription(java.lang.String newDescription) {
00201 description = newDescription.toString();
00202 if ("".equals(description)) {
00203 description = null;
00204 }
00205 }
00206
00207
00208
00209
00210 public void setParams(java.util.Vector newParams) {
00211 params = newParams;
00212 }
00213
00214
00215
00216
00217 public void setParamTypes(java.util.Vector newParamTypes) {
00218 paramTypes = newParamTypes;
00219 }
00220
00221
00222
00223
00224 public void setStatic(boolean isStatic) {
00225 this.isStatic = isStatic;
00226 }
00227
00228
00229
00230
00231 public void setType(edu.ksu.cis.bandera.jjjc.symboltable.ClassOrInterfaceType newType) {
00232 type = newType;
00233 }
00234
00235
00236
00237
00238 public void setUsePrivate(boolean newUsePrivate) {
00239 usePrivate = newUsePrivate;
00240 }
00241
00242
00243
00244
00245 public void setVariablesUsed(java.util.Hashtable newVariablesUsed) {
00246 variablesUsed = newVariablesUsed;
00247 }
00248 }