00001 package edu.ksu.cis.bandera.specification.assertion.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.specification.assertion.exception.*;
00037 import ca.mcgill.sable.soot.*;
00038 import edu.ksu.cis.bandera.jjjc.node.*;
00039 import edu.ksu.cis.bandera.annotation.*;
00040 import edu.ksu.cis.bandera.jjjc.symboltable.*;
00041 public abstract class Assertion {
00042 protected Annotation annotation;
00043 protected Name name;
00044 protected PExp exp;
00045 protected String description;
00046 protected Vector exceptions;
00047
00048
00049
00050
00051
00052
00053
00054 public Assertion(Annotation annotation, Name name, PExp exp, Vector exceptions) throws DuplicateAssertionException {
00055 this.annotation = annotation;
00056 this.name = name;
00057 this.exp = exp;
00058 this.exceptions = exceptions;
00059
00060 Name asName = name.getSuperName();
00061 try {
00062 AssertionSet as = AssertionSet.getAssertionSet(asName);
00063 as.putAssertion(this);
00064 } catch (Exception e) {
00065 AssertionSet as = new AssertionSet(asName);
00066 as.putAssertion(this);
00067 AssertionSet.putAssertionSet(as);
00068 }
00069 }
00070
00071
00072
00073
00074 public edu.ksu.cis.bandera.annotation.Annotation getAnnotation() {
00075 return annotation;
00076 }
00077
00078
00079
00080
00081 public edu.ksu.cis.bandera.jjjc.node.PExp getConstraint() {
00082 return exp;
00083 }
00084
00085
00086
00087
00088 public java.lang.String getDescription() {
00089 return description;
00090 }
00091
00092
00093
00094
00095 public java.util.Vector getExceptions() {
00096 return exceptions;
00097 }
00098
00099
00100
00101
00102 public edu.ksu.cis.bandera.jjjc.symboltable.Name getName() {
00103 return name;
00104 }
00105
00106
00107
00108
00109 public boolean isValid() {
00110 return exceptions.size() == 0;
00111 }
00112
00113
00114
00115
00116 public void setDescription(java.lang.String newDescription) {
00117 description = newDescription;
00118 }
00119
00120
00121
00122
00123 public void setExceptions(java.util.Vector newExceptions) {
00124 exceptions = newExceptions;
00125 }
00126 }