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;
22 * @param cd ClassDescriptor
25 public ClassNode(ClassDescriptor cd, Vector<FlagState> fStates) {
27 this.flagStates = fStates;
29 this.uid=ClassNode.nodeID++;
36 public ScheduleNode getScheduleNode() {
40 public void setScheduleNode(ScheduleNode sn) {
44 public boolean isSorted() {
48 public void setSorted(boolean sorted) {
52 public Vector<FlagState> getFlagStates() {
56 public String toString() {
57 return cd.toString()+getTextLabel();
60 /** @return Iterator over the flags in the flagstate.
63 public Iterator getFlags() {
64 return flagStates.iterator();
67 public int numFlags(){
68 return flagStates.size();
72 * @return returns the classdescriptor of the flagstate.
75 public ClassDescriptor getClassDescriptor(){
79 /** Tests for equality of two flagstate objects.
82 public boolean equals(Object o) {
83 if (o instanceof ClassNode) {
84 ClassNode fs=(ClassNode)o;
85 if ((fs.getClassDescriptor()!= cd) ||
86 (fs.getScheduleNode() != sn) ||
87 (fs.isSorted() != sorted)) {
90 return (fs.getFlagStates().equals(flagStates));
95 public int hashCode() {
96 return cd.hashCode()^flagStates.hashCode();
99 public String getLabel() {
103 public String getClusterLabel() {
104 return "cluster_"+uid;
107 public String getTextLabel() {
109 label = "Class " + this.cd.getSymbol();
116 public Object clone() {
119 o = (ClassNode)super.clone();
120 } catch(CloneNotSupportedException e){
123 o.uid = ClassNode.nodeID++;