1 package Analysis.TaskStateAnalysis;
2 import Analysis.TaskStateAnalysis.*;
9 public class TagState extends GraphNode {
10 private TagDescriptor tag;
11 private ClassDescriptor cd;
12 private Hashtable<FlagState, Integer> flags;
13 public static final int KLIMIT=2;
14 public HashSet<TaskDescriptor> sourceset;
16 public TagState(ClassDescriptor cd) {
17 this.flags=new Hashtable<FlagState, Integer>();
18 this.sourceset=new HashSet<TaskDescriptor>();
22 public void addSource(TaskDescriptor td) {
26 public TagState(TagDescriptor tag) {
28 this.flags=new Hashtable<FlagState, Integer>();
29 this.sourceset=new HashSet<TaskDescriptor>();
32 public TagDescriptor getTag() {
36 public ClassDescriptor getClassDesc() {
40 public TagState[] clearFS(FlagState fs) {
42 if (flags.containsKey(fs))
43 num=flags.get(fs).intValue();
47 TagState ts=new TagState(tag);
48 ts.flags.putAll(flags);
49 ts.flags.put(fs, new Integer(num));
52 return new TagState[] {ts, this};
54 return new TagState[] {ts};
57 public TagState[] addnewFS(FlagState fs) {
59 if (flags.containsKey(fs))
60 num=flags.get(fs).intValue();
64 TagState ts=new TagState(tag);
65 ts.flags.putAll(flags);
66 ts.flags.put(fs, new Integer(num));
67 return new TagState[] {ts};
70 public TagState[] addFS(FlagState fs) {
72 if (flags.containsKey(fs))
73 num=flags.get(fs).intValue();
77 TagState ts=new TagState(tag);
78 ts.flags.putAll(flags);
79 ts.flags.put(fs, new Integer(num));
81 return new TagState[] {ts};
83 return new TagState[] {this, ts};
86 public boolean containsFS(FlagState fs) {
87 return flags.containsKey(fs);
90 public Set<FlagState> getFS() {
91 return flags.keySet();
94 public int hashCode() {
95 int hashcode=flags.hashCode();
97 hashcode^=tag.hashCode();
101 public boolean equals(Object o) {
102 if (o instanceof TagState) {
103 TagState t=(TagState)o;
104 if ((tag==null&&t.tag==null)||
105 (tag!=null&&t.tag!=null&&tag.equals(t.tag))) {
106 return flags.equals(t.flags);