1 package Analysis.Scheduling;
3 import Analysis.TaskStateAnalysis.*;
9 /** This class holds a flag diagram for one class.
11 public class ClassNode extends GraphNode implements Cloneable {
14 private static int nodeID=0;
16 private final ClassDescriptor cd;
17 private ScheduleNode sn;
18 private Vector<FlagState> flagStates;
19 private boolean sorted = false;
20 private boolean clone = false;
22 private int transTime;
25 * @param cd ClassDescriptor
28 public ClassNode(ClassDescriptor cd, Vector<FlagState> fStates) {
30 this.flagStates = fStates;
32 this.uid=ClassNode.nodeID++;
36 public int getTransTime() {
37 return this.transTime;
40 public void setTransTime(int transTime) {
41 this.transTime = transTime;
48 public ScheduleNode getScheduleNode() {
52 public void setScheduleNode(ScheduleNode sn) {
56 public boolean isSorted() {
60 public void setSorted(boolean sorted) {
64 public Vector<FlagState> getFlagStates() {
68 public boolean isclone() {
72 public String toString() {
73 return cd.toString()+getTextLabel();
76 /** @return Iterator over the flags in the flagstate.
79 public Iterator getFlags() {
80 return flagStates.iterator();
83 public int numFlags() {
84 return flagStates.size();
88 * @return returns the classdescriptor of the flagstate.
91 public ClassDescriptor getClassDescriptor() {
95 /** Tests for equality of two flagstate objects.
98 public boolean equals(Object o) {
99 if (o instanceof ClassNode) {
100 ClassNode fs=(ClassNode)o;
101 if ((fs.getClassDescriptor()!= cd) ||
102 (fs.isSorted() != sorted) ||
103 (fs.clone != this.clone) ||
104 (fs.transTime != this.transTime)) {
107 return (fs.getFlagStates().equals(flagStates));
112 public int hashCode() {
113 return cd.hashCode()^Boolean.toString(sorted).hashCode()^Boolean.toString(clone).hashCode()^
114 transTime^flagStates.hashCode();
117 public String getLabel() {
121 public String getClusterLabel() {
122 return "cluster_"+uid;
125 public String getTextLabel() {
127 label = "Class " + this.cd.getSymbol();
134 public Object clone() {
137 o = (ClassNode) super.clone();
138 } catch(CloneNotSupportedException e){
141 o.uid = ClassNode.nodeID++;
146 public void calExeTime() {
147 for(int i = 0; i < this.flagStates.size(); i++) {
148 this.flagStates.elementAt(i).getExeTime();