1 19 20 package ca.mcgill.sable.soot.cfg.model; 21 22 import java.util.*; 23 import org.eclipse.draw2d.graph.*; 24 25 public class CFGNode extends CFGElement { 26 27 28 private ArrayList inputs = new ArrayList(); 29 private ArrayList outputs = new ArrayList(); 30 private CFGFlowData before; 31 private CFGFlowData after; 32 private CFGNodeData data; 33 34 private ArrayList children = new ArrayList(); 35 36 public CFGNode() { 37 super(); 38 } 39 40 public void addInput(CFGEdge input){ 41 getInputs().add(input); 42 fireStructureChange(CFGElement.INPUTS, input); 43 } 44 45 public void addOutput(CFGEdge output){ 46 getOutputs().add(output); 47 fireStructureChange(CFGElement.OUTPUTS, output); 48 } 49 50 53 public ArrayList getInputs() { 54 return inputs; 55 } 56 57 60 public ArrayList getOutputs() { 61 return outputs; 62 } 63 64 67 public void setInputs(ArrayList list) { 68 inputs = list; 69 } 70 71 74 public void setOutputs(ArrayList list) { 75 outputs = list; 76 } 77 78 81 public CFGFlowData getAfter() { 82 return after; 83 } 84 85 88 public CFGFlowData getBefore() { 89 return before; 90 } 91 92 95 public void setAfter(CFGFlowData data) { 96 after = data; 97 int last = getChildren().size() - 1; 98 if (getChildren().get(last) instanceof CFGFlowData){ 99 getChildren().remove(last); 100 } 101 getChildren().add(after); 102 103 firePropertyChange(AFTER_INFO, after); 104 } 105 106 109 public void setBefore(CFGFlowData data) { 110 before = data; 111 if (getChildren().get(0) instanceof CFGFlowData){ 112 getChildren().remove(0); 113 } 114 getChildren().add(0, before); 115 116 firePropertyChange(BEFORE_INFO, before); 117 } 118 119 122 public CFGNodeData getData() { 123 return data; 124 } 125 126 129 public void setData(CFGNodeData data) { 130 this.data = data; 131 getChildren().add(data); 132 firePropertyChange(NODE_DATA, data); 133 } 134 135 138 public ArrayList getChildren() { 139 return children; 140 } 141 142 145 public void setChildren(ArrayList list) { 146 children = list; 147 } 148 149 public void handleClickEvent(Object evt){ 150 firePropertyChange(REVEAL, this); 151 } 152 153 public void handleHighlightEvent(Object evt){ 154 firePropertyChange(HIGHLIGHT, this); 155 } 156 } 157 | Popular Tags |