00001 package edu.ksu.cis.bandera.pdgslicer.dependency;
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
00036 import ca.mcgill.sable.soot.*;
00037 import ca.mcgill.sable.util.Collection;
00038 import ca.mcgill.sable.util.Map;
00039 import ca.mcgill.sable.util.Set;
00040 import ca.mcgill.sable.util.ArraySet;
00041 import ca.mcgill.sable.util.Iterator;
00042 import ca.mcgill.sable.util.List;
00043 import ca.mcgill.sable.soot.jimple.*;
00044 import edu.ksu.cis.bandera.pdgslicer.*;
00045 import edu.ksu.cis.bandera.pdgslicer.datastructure.*;
00046 import edu.ksu.cis.bandera.jjjc.*;
00047 import edu.ksu.cis.bandera.bui.BUI;
00048 import edu.ksu.cis.bandera.annotation.*;
00049 import edu.ksu.cis.bandera.bofa.Analysis;
00050
00051 import java.util.Hashtable;
00052 import java.util.LinkedList;
00053 import java.util.BitSet;
00054 import java.util.Vector;
00055 import java.util.Enumeration;
00056 import java.io.*;
00057 import javax.swing.*;
00058 import javax.swing.tree.*;
00059 import java.awt.*;
00060 public class Dependencies extends JFrame implements java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener {
00061 private Analysis BOFA_Analysis;
00062 public boolean success = true;
00063 Slicer slicer = null;
00064 private QueryPanel queryPanel = null;
00065 private DependencyValueViewer dependencyValueViewer = null;
00066 CriterionViewer criterionViewer = null;
00067 private final int DATA = 0;
00068 private final int CONTROL = 1;
00069 private final int DIVERGENT = 2;
00070 private final int READY = 3;
00071 private final int INTERFERENCE = 4;
00072 private final int SYNCHRONIZATION = 5;
00073 private final int VALUE_PRED = 6;
00074 private final int VALUE_SUCC = 7;
00075 private final int VALUE_SET = 8;
00076 List dependencyKindsList;
00077 private String dependencyKinds[] = {"Data Dependence", "Control Dependence", "Divergent Dependence", "Ready Dependence", "Interference Dependence", "Synchronization Dependence"};
00078 List valueKindsList;
00079 private String valueKinds[] = {"Value Predecessors", "Value Successors", "Value Set"};
00080 private boolean isSetSelectedByProgram = false;
00081 Annotation currentMethodDecAnn = null;
00082 private boolean isChangeCheckBoxByProgram = false;
00083 private boolean isSetItemByProgram = false;
00084 private boolean doSuccDataDepend = false;
00085 private boolean doPredDataDepend = false;
00086 private boolean doSuccControlDepend = false;
00087 private boolean doPredControlDepend = false;
00088 private boolean doSuccReadyDepend = false;
00089 private boolean doPredReadyDepend = false;
00090 private boolean doSuccSynchDepend = false;
00091 private boolean doPredSynchDepend = false;
00092 private boolean doSuccInterferDepend = false;
00093 private boolean doPredInterferDepend = false;
00094 private boolean doSuccDivergentDepend = false;
00095 private boolean doPredDivergentDepend = false;
00096 private boolean doPredValue = false;
00097 private boolean doSuccValue = false;
00098 private boolean doSetValue = false;
00099 private Hashtable nodeToConfigTable = new Hashtable();
00100 Object currentNode = null;
00101 private LinkedList historyChain = new LinkedList();
00102 private int currentPositionOfHistoryChain = -1;
00103 public static Dependencies dependFrame;
00104 private JPanel ivjCheckBoxesPanel = null;
00105 private JPanel ivjDependencyFrameContentPane = null;
00106 private JToolBar ivjDependOperationToolBar = null;
00107 private JPanel ivjOperationPanel = null;
00108 private JPanel ivjToolBarPanel = null;
00109 private JLabel ivjCurrentStmtLabel = null;
00110 private JComboBox ivjHistoryComboBox = null;
00111 private JButton ivjBackwardSliceToolBarButton = null;
00112 private JButton ivjForwardSliceToolBarButton = null;
00113 private JButton ivjBackToolBarButton = null;
00114 private JButton ivjClearToolBarButton = null;
00115 private JButton ivjForwardToolBarButton = null;
00116 private JLabel ivjValueFlowLabel = null;
00117 private JCheckBox ivjValuePredCheckBox = null;
00118 private JCheckBox ivjValueSetCheckBox = null;
00119 private JCheckBox ivjValueSuccCheckBox = null;
00120 private JLabel ivjControlLabel = null;
00121 private JCheckBox ivjControlPredCheckBox = null;
00122 private JCheckBox ivjControlSuccCheckBox = null;
00123 private JLabel ivjDataLabel = null;
00124 private JCheckBox ivjDataPredCheckBox = null;
00125 private JCheckBox ivjDataSuccCheckBox = null;
00126 private JLabel ivjInterferLabel = null;
00127 private JCheckBox ivjInterferPredCheckBox = null;
00128 private JCheckBox ivjInterferSuccCheckBox = null;
00129 private JLabel ivjReadyLabel = null;
00130 private JCheckBox ivjReadyPredCheckBox = null;
00131 private JCheckBox ivjReadySuccCheckBox = null;
00132 private JLabel ivjSynchLabel = null;
00133 private JCheckBox ivjSynchPredCheckBox = null;
00134 private JCheckBox ivjSynchSuccCheckBox = null;
00135 private JLabel ivjDiverLabel = null;
00136 private JCheckBox ivjDiverPredCheckBox = null;
00137 private JCheckBox ivjDiverSuccCheckBox = null;
00138 private CodeBrowserPane ivjCodeBrowserPane = null;
00139 private JSplitPane ivjCodeCritSplitPane = null;
00140 private JButton ivjAllpredButton = null;
00141 private JButton ivjAllsuccButton = null;
00142 private JPanel ivjDependCheckBoxesPanel = null;
00143 private JLabel ivjDependLabel = null;
00144 private JLabel ivjDpredLabel = null;
00145 private JLabel ivjDsuccLabel = null;
00146 private JPanel ivjEmptyPanel = null;
00147 private JButton ivjNopredButton = null;
00148 private JButton ivjNosuccButton = null;
00149 private JPanel ivjToolBarInPanel = null;
00150 private JPanel ivjValueCheckBoxesPanel = null;
00151 private FlowLayout ivjValueCheckBoxesPanelFlowLayout = null;
00152 private JButton ivjAllDependButton = null;
00153 private JButton ivjClearDependButton = null;
00154 private JButton ivjClearValuesButton = null;
00155 private JButton ivjAllValuesButton = null;
00156 private ViewerTabbedPane ivjViewerTabbedPane = null;
00157 IvjEventHandler ivjEventHandler = new IvjEventHandler();
00158
00159 class IvjEventHandler implements java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener {
00160 public void actionPerformed(java.awt.event.ActionEvent e) {
00161 if (e.getSource() == Dependencies.this.getHistoryComboBox())
00162 connEtoC9();
00163 if (e.getSource() == Dependencies.this.getBackToolBarButton())
00164 connEtoC10(e);
00165 if (e.getSource() == Dependencies.this.getForwardToolBarButton())
00166 connEtoC11(e);
00167 if (e.getSource() == Dependencies.this.getClearToolBarButton())
00168 connEtoC15();
00169 if (e.getSource() == Dependencies.this.getAllpredButton())
00170 connEtoC28(e);
00171 if (e.getSource() == Dependencies.this.getAllsuccButton())
00172 connEtoC29(e);
00173 if (e.getSource() == Dependencies.this.getAllDependButton())
00174 connEtoC30(e);
00175 if (e.getSource() == Dependencies.this.getNopredButton())
00176 connEtoC31(e);
00177 if (e.getSource() == Dependencies.this.getNosuccButton())
00178 connEtoC32(e);
00179 if (e.getSource() == Dependencies.this.getClearDependButton())
00180 connEtoC33(e);
00181 if (e.getSource() == Dependencies.this.getAllValuesButton())
00182 connEtoC34(e);
00183 if (e.getSource() == Dependencies.this.getClearValuesButton())
00184 connEtoC35(e);
00185 if (e.getSource() == Dependencies.this.getBackwardSliceToolBarButton())
00186 connEtoC2();
00187 };
00188 public void itemStateChanged(java.awt.event.ItemEvent e) {
00189 if (e.getSource() == Dependencies.this.getDataPredCheckBox())
00190 connEtoC8(e);
00191 if (e.getSource() == Dependencies.this.getDataSuccCheckBox())
00192 connEtoC12(e);
00193 if (e.getSource() == Dependencies.this.getControlPredCheckBox())
00194 connEtoC13(e);
00195 if (e.getSource() == Dependencies.this.getControlSuccCheckBox())
00196 connEtoC16(e);
00197 if (e.getSource() == Dependencies.this.getDiverPredCheckBox())
00198 connEtoC17(e);
00199 if (e.getSource() == Dependencies.this.getDiverSuccCheckBox())
00200 connEtoC18(e);
00201 if (e.getSource() == Dependencies.this.getReadyPredCheckBox())
00202 connEtoC19(e);
00203 if (e.getSource() == Dependencies.this.getReadySuccCheckBox())
00204 connEtoC20(e);
00205 if (e.getSource() == Dependencies.this.getInterferPredCheckBox())
00206 connEtoC21(e);
00207 if (e.getSource() == Dependencies.this.getInterferSuccCheckBox())
00208 connEtoC22(e);
00209 if (e.getSource() == Dependencies.this.getSynchPredCheckBox())
00210 connEtoC23(e);
00211 if (e.getSource() == Dependencies.this.getSynchSuccCheckBox())
00212 connEtoC24(e);
00213 if (e.getSource() == Dependencies.this.getValuePredCheckBox())
00214 connEtoC25(e);
00215 if (e.getSource() == Dependencies.this.getValueSuccCheckBox())
00216 connEtoC26(e);
00217 if (e.getSource() == Dependencies.this.getValueSetCheckBox())
00218 connEtoC27(e);
00219 };
00220 public void windowActivated(java.awt.event.WindowEvent e) {};
00221 public void windowClosed(java.awt.event.WindowEvent e) {
00222 if (e.getSource() == Dependencies.this)
00223 connEtoC1(e);
00224 };
00225 public void windowClosing(java.awt.event.WindowEvent e) {};
00226 public void windowDeactivated(java.awt.event.WindowEvent e) {};
00227 public void windowDeiconified(java.awt.event.WindowEvent e) {};
00228 public void windowIconified(java.awt.event.WindowEvent e) {};
00229 public void windowOpened(java.awt.event.WindowEvent e) {};
00230 };
00231
00232
00233
00234 public Dependencies() {
00235 super();
00236 initialize();
00237
00238 }
00239
00240
00241
00242
00243 public Dependencies(String title) {
00244 super(title);
00245 }
00246
00247
00248
00249
00250
00251 public void actionPerformed(java.awt.event.ActionEvent e) {
00252
00253
00254 if (e.getSource() == getHistoryComboBox())
00255 connEtoC9();
00256 if (e.getSource() == getBackToolBarButton())
00257 connEtoC10(e);
00258 if (e.getSource() == getForwardToolBarButton())
00259 connEtoC11(e);
00260 if (e.getSource() == getClearToolBarButton())
00261 connEtoC15();
00262 if (e.getSource() == getAllpredButton())
00263 connEtoC28(e);
00264 if (e.getSource() == getAllsuccButton())
00265 connEtoC29(e);
00266 if (e.getSource() == getAllDependButton())
00267 connEtoC30(e);
00268 if (e.getSource() == getNopredButton())
00269 connEtoC31(e);
00270 if (e.getSource() == getNosuccButton())
00271 connEtoC32(e);
00272 if (e.getSource() == getClearDependButton())
00273 connEtoC33(e);
00274 if (e.getSource() == getAllValuesButton())
00275 connEtoC34(e);
00276 if (e.getSource() == getClearValuesButton())
00277 connEtoC35(e);
00278 if (e.getSource() == getBackwardSliceToolBarButton())
00279 connEtoC2();
00280
00281
00282 }
00283 public void addSelectedNodeToDependFrame(StmtTreeNode nodeTobeAdded) {
00284
00285 if (nodeTobeAdded == null)
00286 return;
00287 if (!getClearToolBarButton().isEnabled())
00288 getClearToolBarButton().setEnabled(true);
00289 if (!getBackwardSliceToolBarButton().isEnabled())
00290 getBackwardSliceToolBarButton().setEnabled(true);
00291 if (!getForwardSliceToolBarButton().isEnabled())
00292 getForwardSliceToolBarButton().setEnabled(true);
00293
00294
00295
00296
00297 int itemIndex = historyComboBoxItemsContains(nodeTobeAdded);
00298 Configuration currentConfig = null;
00299 if (itemIndex >= 0) {
00300 int selectedIndex = getHistoryComboBox().getSelectedIndex();
00301 if (itemIndex == selectedIndex)
00302 return;
00303 currentConfig = getCurrentConfig();
00304 nodeToConfigTable.put(currentNode, currentConfig);
00305
00306 compactHistoryChain(currentNode);
00307 historyChain.addLast(currentNode);
00308 currentPositionOfHistoryChain++;
00309 if (!getBackToolBarButton().isEnabled())
00310 getBackToolBarButton().setEnabled(true);
00311 currentNode = getHistoryComboBox().getItemAt(itemIndex);
00312 Configuration oldConfig = (Configuration) nodeToConfigTable.get(currentNode);
00313 if (!doDependsInConfig(oldConfig) && !doValuesInConfig(oldConfig)) {
00314 initializeConfig();
00315 if (nodeTobeAdded instanceof StmtTreeNode)
00316 currentMethodDecAnn = ((StmtTreeNode) nodeTobeAdded).currentMethodDeclarationAnnotation;
00317 dependencyValueViewer.currentDependTreeRoot = new DefaultMutableTreeNode(currentNode);
00318 dependencyValueViewer.getDependencyTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentDependTreeRoot));
00319 dependencyValueViewer.currentValueTreeRoot = new DefaultMutableTreeNode(currentNode);
00320 dependencyValueViewer.getValueTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentValueTreeRoot));
00321 if (currentConfig != null)
00322 restoreConfigByAddingNewNode(currentConfig);
00323 } else
00324 restoreConfig(oldConfig);
00325 isSetItemByProgram = true;
00326 getHistoryComboBox().setSelectedIndex(itemIndex);
00327 isSetItemByProgram = false;
00328 return;
00329 }
00330 isSetItemByProgram = true;
00331 getHistoryComboBox().insertItemAt(nodeTobeAdded, 0);
00332 getHistoryComboBox().setSelectedIndex(0);
00333 isSetItemByProgram = false;
00334 if (currentNode != null) {
00335
00336 currentConfig = getCurrentConfig();
00337 nodeToConfigTable.put(currentNode, currentConfig);
00338
00339 compactHistoryChain(currentNode);
00340 historyChain.addLast(currentNode);
00341 currentPositionOfHistoryChain++;
00342 if (!getBackToolBarButton().isEnabled())
00343 getBackToolBarButton().setEnabled(true);
00344 }
00345
00346 initializeConfig();
00347 currentNode = nodeTobeAdded;
00348 if (nodeTobeAdded instanceof StmtTreeNode)
00349 currentMethodDecAnn = ((StmtTreeNode) nodeTobeAdded).currentMethodDeclarationAnnotation;
00350 dependencyValueViewer.currentDependTreeRoot = new DefaultMutableTreeNode(currentNode);
00351 dependencyValueViewer.getDependencyTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentDependTreeRoot));
00352 dependencyValueViewer.currentValueTreeRoot = new DefaultMutableTreeNode(currentNode);
00353 dependencyValueViewer.getValueTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentValueTreeRoot));
00354 if (currentConfig != null)
00355 restoreConfigByAddingNewNode(currentConfig);
00356 }
00357
00358
00359
00360 public void allDependButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
00361 if (currentNode == null) {
00362 selectStatementWarning(getAllDependButton());
00363 return;
00364 }
00365 dependencyValueViewer.setState(Frame.NORMAL);
00366 dependencyValueViewer.toFront();
00367 isChangeCheckBoxByProgram = true;
00368 if (!doPredDataDepend) {
00369 doPredDataDepend = true;
00370 getDataPredCheckBox().setSelected(true);
00371 }
00372 if (!doPredControlDepend) {
00373 doPredControlDepend = true;
00374 getControlPredCheckBox().setSelected(true);
00375 }
00376 if (!doPredReadyDepend) {
00377 doPredReadyDepend = true;
00378 getReadyPredCheckBox().setSelected(true);
00379 }
00380 if (!doPredSynchDepend) {
00381 doPredSynchDepend = true;
00382 getSynchPredCheckBox().setSelected(true);
00383 }
00384 if (!doPredInterferDepend) {
00385 doPredInterferDepend = true;
00386 getInterferPredCheckBox().setSelected(true);
00387 }
00388 if (!doPredDivergentDepend) {
00389 doPredDivergentDepend = true;
00390 getDiverPredCheckBox().setSelected(true);
00391 }
00392 if (!doSuccDataDepend) {
00393 doSuccDataDepend = true;
00394 getDataSuccCheckBox().setSelected(true);
00395 }
00396 if (!doSuccControlDepend) {
00397 doSuccControlDepend = true;
00398 getControlSuccCheckBox().setSelected(true);
00399 }
00400 if (!doSuccReadyDepend) {
00401 doSuccReadyDepend = true;
00402 getReadySuccCheckBox().setSelected(true);
00403 }
00404 if (!doSuccSynchDepend) {
00405 doSuccSynchDepend = true;
00406 getSynchSuccCheckBox().setSelected(true);
00407 }
00408 if (!doSuccInterferDepend) {
00409 doSuccInterferDepend = true;
00410 getInterferSuccCheckBox().setSelected(true);
00411 }
00412 if (!doSuccDivergentDepend) {
00413 doSuccDivergentDepend = true;
00414 getDiverSuccCheckBox().setSelected(true);
00415 }
00416 isChangeCheckBoxByProgram = false;
00417 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
00418 Set dependencySet = new ca.mcgill.sable.util.ArraySet(this.dependencyKinds);
00419 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
00420 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
00421 String dependKind = oneChild.toString();
00422 dependencySet.remove(dependKind);
00423 boolean foundSuccessor = false;
00424 boolean foundPredecessor = false;
00425 for (int j = 0; j < oneChild.getChildCount(); j++) {
00426 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
00427 if (predSuccChild.toString().equals("Successors"))
00428 foundSuccessor = true;
00429 else
00430 if (predSuccChild.toString().equals("Predecessors"))
00431 foundPredecessor = true;
00432 }
00433 if (!foundSuccessor) {
00434 DefaultMutableTreeNode currentDependencyRoot = oneChild;
00435 DefaultMutableTreeNode dependencySuccTreeNode = getDependencyTreeNode(dependKind, false);
00436 treeModel.insertNodeInto(dependencySuccTreeNode, currentDependencyRoot, currentDependencyRoot.getChildCount());
00437
00438 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dependencySuccTreeNode.getPath()));
00439 }
00440 if (!foundPredecessor) {
00441 DefaultMutableTreeNode currentDependencyRoot = oneChild;
00442 DefaultMutableTreeNode dependencyPredTreeNode = getDependencyTreeNode(dependKind, true);
00443 treeModel.insertNodeInto(dependencyPredTreeNode, currentDependencyRoot, 0);
00444
00445 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dependencyPredTreeNode.getPath()));
00446 }
00447 }
00448 boolean isDependency = true;
00449 for (Iterator dependIt = dependencySet.iterator(); dependIt.hasNext();) {
00450 String dependKind = (String) dependIt.next();
00451 DefaultMutableTreeNode currentDependencyRoot = new DefaultMutableTreeNode(dependKind);
00452 int insertIndex = dependencyValueViewer.getInsertIndexOf(dependKind, isDependency);
00453 treeModel.insertNodeInto(currentDependencyRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
00454 DefaultMutableTreeNode dependencyPredTreeNode = getDependencyTreeNode(dependKind, true);
00455 treeModel.insertNodeInto(dependencyPredTreeNode, currentDependencyRoot, 0);
00456 DefaultMutableTreeNode dependencySuccTreeNode = getDependencyTreeNode(dependKind, false);
00457 treeModel.insertNodeInto(dependencySuccTreeNode, currentDependencyRoot, 1);
00458
00459 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(currentDependencyRoot.getPath()));
00460 }
00461 dependencyValueViewer.expandDependTreeToOneLevel(isDependency);
00462 dependencyValueViewer.changeViewerState();
00463 return;
00464 }
00465
00466
00467
00468 public void allpredButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
00469 if (currentNode == null) {
00470 selectStatementWarning(getAllpredButton());
00471 return;
00472 }
00473 dependencyValueViewer.setState(Frame.NORMAL);
00474 dependencyValueViewer.toFront();
00475 isChangeCheckBoxByProgram = true;
00476 if (!doPredDataDepend) {
00477 doPredDataDepend = true;
00478 getDataPredCheckBox().setSelected(true);
00479 }
00480 if (!doPredControlDepend) {
00481 doPredControlDepend = true;
00482 getControlPredCheckBox().setSelected(true);
00483 }
00484 if (!doPredReadyDepend) {
00485 doPredReadyDepend = true;
00486 getReadyPredCheckBox().setSelected(true);
00487 }
00488 if (!doPredSynchDepend) {
00489 doPredSynchDepend = true;
00490 getSynchPredCheckBox().setSelected(true);
00491 }
00492 if (!doPredInterferDepend) {
00493 doPredInterferDepend = true;
00494 getInterferPredCheckBox().setSelected(true);
00495 }
00496 if (!doPredDivergentDepend) {
00497 doPredDivergentDepend = true;
00498 getDiverPredCheckBox().setSelected(true);
00499 }
00500 isChangeCheckBoxByProgram = false;
00501
00502
00503
00504
00505
00506 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
00507 Set dependencySet = new ca.mcgill.sable.util.ArraySet(this.dependencyKinds);
00508 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
00509 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
00510 String dependKind = oneChild.toString();
00511 dependencySet.remove(dependKind);
00512 boolean foundPredecessor = false;
00513 for (int j = 0; j < oneChild.getChildCount(); j++) {
00514 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
00515 if (predSuccChild.toString().equals("Predecessors"))
00516 foundPredecessor = true;
00517 }
00518 if (foundPredecessor)
00519 continue;
00520 DefaultMutableTreeNode currentDependencyRoot = oneChild;
00521 DefaultMutableTreeNode dependencyPredTreeNode = getDependencyTreeNode(dependKind, true);
00522 treeModel.insertNodeInto(dependencyPredTreeNode, currentDependencyRoot, 0);
00523
00524 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dependencyPredTreeNode.getPath()));
00525 }
00526 boolean isDependency = true;
00527 for (Iterator dependIt = dependencySet.iterator(); dependIt.hasNext();) {
00528 String dependKind = (String) dependIt.next();
00529 DefaultMutableTreeNode currentDependencyRoot = new DefaultMutableTreeNode(dependKind);
00530 int insertIndex = dependencyValueViewer.getInsertIndexOf(dependKind, isDependency);
00531 treeModel.insertNodeInto(currentDependencyRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
00532 DefaultMutableTreeNode dependencyPredTreeNode = getDependencyTreeNode(dependKind, true);
00533 treeModel.insertNodeInto(dependencyPredTreeNode, currentDependencyRoot, 0);
00534
00535 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dependencyPredTreeNode.getPath()));
00536 }
00537 dependencyValueViewer.expandDependTreeToOneLevel(isDependency);
00538 dependencyValueViewer.changeViewerState();
00539 return;
00540 }
00541
00542
00543
00544 public void allsuccButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
00545 if (currentNode == null) {
00546 selectStatementWarning(getAllsuccButton());
00547 return;
00548 }
00549 dependencyValueViewer.setState(Frame.NORMAL);
00550 dependencyValueViewer.toFront();
00551 isChangeCheckBoxByProgram = true;
00552 if (!doSuccDataDepend) {
00553 doSuccDataDepend = true;
00554 getDataSuccCheckBox().setSelected(true);
00555 }
00556 if (!doSuccControlDepend) {
00557 doSuccControlDepend = true;
00558 getControlSuccCheckBox().setSelected(true);
00559 }
00560 if (!doSuccReadyDepend) {
00561 doSuccReadyDepend = true;
00562 getReadySuccCheckBox().setSelected(true);
00563 }
00564 if (!doSuccSynchDepend) {
00565 doSuccSynchDepend = true;
00566 getSynchSuccCheckBox().setSelected(true);
00567 }
00568 if (!doSuccInterferDepend) {
00569 doSuccInterferDepend = true;
00570 getInterferSuccCheckBox().setSelected(true);
00571 }
00572 if (!doSuccDivergentDepend) {
00573 doSuccDivergentDepend = true;
00574 getDiverSuccCheckBox().setSelected(true);
00575 }
00576 isChangeCheckBoxByProgram = false;
00577 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
00578 Set dependencySet = new ca.mcgill.sable.util.ArraySet(this.dependencyKinds);
00579 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
00580 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
00581 String dependKind = oneChild.toString();
00582 dependencySet.remove(dependKind);
00583 boolean foundSuccessor = false;
00584 for (int j = 0; j < oneChild.getChildCount(); j++) {
00585 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
00586 if (predSuccChild.toString().equals("Successors"))
00587 foundSuccessor = true;
00588 }
00589 if (foundSuccessor)
00590 continue;
00591 DefaultMutableTreeNode currentDependencyRoot = oneChild;
00592 DefaultMutableTreeNode dependencySuccTreeNode = getDependencyTreeNode(dependKind, false);
00593 treeModel.insertNodeInto(dependencySuccTreeNode, currentDependencyRoot, currentDependencyRoot.getChildCount());
00594
00595 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dependencySuccTreeNode.getPath()));
00596 }
00597 boolean isDependency = true;
00598 for (Iterator dependIt = dependencySet.iterator(); dependIt.hasNext();) {
00599 String dependKind = (String) dependIt.next();
00600 DefaultMutableTreeNode currentDependencyRoot = new DefaultMutableTreeNode(dependKind);
00601 int insertIndex = dependencyValueViewer.getInsertIndexOf(dependKind, isDependency);
00602 treeModel.insertNodeInto(currentDependencyRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
00603 DefaultMutableTreeNode dependencySuccTreeNode = getDependencyTreeNode(dependKind, false);
00604 treeModel.insertNodeInto(dependencySuccTreeNode, currentDependencyRoot, 0);
00605
00606 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dependencySuccTreeNode.getPath()));
00607 }
00608 dependencyValueViewer.expandDependTreeToOneLevel(isDependency);
00609 dependencyValueViewer.changeViewerState();
00610 return;
00611 }
00612
00613
00614
00615 public void allValuesButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
00616 if (currentNode == null) {
00617 selectStatementWarning(getAllValuesButton());
00618 return;
00619 }
00620 dependencyValueViewer.setState(Frame.NORMAL);
00621 dependencyValueViewer.toFront();
00622 isChangeCheckBoxByProgram = true;
00623 if (!doPredValue) {
00624 doPredValue = true;
00625 getValuePredCheckBox().setSelected(true);
00626 }
00627 if (!doSuccValue) {
00628 doSuccValue = true;
00629 getValueSuccCheckBox().setSelected(true);
00630 }
00631 if (!doSetValue) {
00632 doSetValue = true;
00633 getValueSetCheckBox().setSelected(true);
00634 }
00635 isChangeCheckBoxByProgram = false;
00636 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getValueTree().getModel();
00637 Set valueKindSet = new ca.mcgill.sable.util.ArraySet(this.valueKinds);
00638 for (int i = 0; i < dependencyValueViewer.currentValueTreeRoot.getChildCount(); i++) {
00639 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentValueTreeRoot.getChildAt(i);
00640 String valueKind = oneChild.toString();
00641 valueKindSet.remove(valueKind);
00642 }
00643 boolean isDependency = false;
00644 for (Iterator kindIt = valueKindSet.iterator(); kindIt.hasNext();) {
00645 String valueKind = (String) kindIt.next();
00646 DefaultMutableTreeNode currentValueTreeRoot = dependencyValueViewer.currentValueTreeRoot;
00647 int insertIndex = dependencyValueViewer.getInsertIndexOf(valueKind, isDependency);
00648 DefaultMutableTreeNode valueTreeNode = getValueTreeNode(valueKind);
00649 treeModel.insertNodeInto(valueTreeNode, currentValueTreeRoot, insertIndex);
00650
00651
00652 dependencyValueViewer.getValueTree().scrollPathToVisible(new TreePath(currentValueTreeRoot.getPath()));
00653 }
00654
00655 dependencyValueViewer.expandAndCollapseFrom(dependencyValueViewer.currentValueTreeRoot, isDependency);
00656 dependencyValueViewer.changeViewerState();
00657 return;
00658 }
00659
00660
00661
00662 public void backToolBarButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
00663 dependencyValueViewer.setState(Frame.NORMAL);
00664 dependencyValueViewer.toFront();
00665
00666 if (currentPositionOfHistoryChain == historyChain.size() - 1) {
00667 compactHistoryChain(currentNode);
00668 historyChain.addLast(currentNode);
00669 currentPositionOfHistoryChain++;
00670 }
00671 Configuration config = getCurrentConfig();
00672 nodeToConfigTable.put(currentNode, config);
00673
00674 --currentPositionOfHistoryChain;
00675 currentNode = historyChain.get(currentPositionOfHistoryChain);
00676 config = (Configuration) nodeToConfigTable.get(currentNode);
00677 restoreConfig(config);
00678 isSetItemByProgram = true;
00679 getHistoryComboBox().setSelectedItem(currentNode);
00680 isSetItemByProgram = false;
00681 if (currentPositionOfHistoryChain == 0)
00682 getBackToolBarButton().setEnabled(false);
00683 if (!getForwardToolBarButton().isEnabled())
00684 getForwardToolBarButton().setEnabled(true);
00685 return;
00686 }
00687
00688
00689
00690 public void backwardSliceToolBarButton_ActionEvents() {
00691 this.criterionViewer.runSlicerWithCurrentCriterion();
00692 return;
00693 }
00694
00695
00696
00697
00698 private void calculateValueSet(DefaultMutableTreeNode valueRoot) {
00699 Annotation mda = null;
00700 Annotation stmtAnnotation = null;
00701 if (currentNode instanceof StmtTreeNode) {
00702 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
00703 mda = startTreeNode.currentMethodDeclarationAnnotation;
00704 currentMethodDecAnn = mda;
00705 stmtAnnotation = startTreeNode.currentStmtAnnotation;
00706 } else
00707 if (currentNode instanceof Annotation) {
00708 mda = currentMethodDecAnn;
00709 stmtAnnotation = (Annotation) currentNode;
00710 } else
00711 return;
00712 SootMethod sootMethod = null;
00713 if (mda instanceof MethodDeclarationAnnotation)
00714 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
00715 else
00716 if (mda instanceof ConstructorDeclarationAnnotation)
00717 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
00718
00719 Stmt[] stmtsInAnnotation;
00720 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
00721 stmtsInAnnotation = stmtAnnotation.getStatements();
00722
00723
00724 } else
00725 if (stmtAnnotation instanceof ConditionalAnnotation) {
00726 stmtsInAnnotation = new Stmt[1];
00727 Stmt[] testStmts = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
00728 stmtsInAnnotation[0] = testStmts[0];
00729 } else
00730 if (stmtAnnotation instanceof ControlFlowAnnotation) {
00731 stmtsInAnnotation = new Stmt[1];
00732 Stmt[] testStmts = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
00733 stmtsInAnnotation[0] = testStmts[0];
00734 } else
00735 stmtsInAnnotation = stmtAnnotation.getStatements();
00736
00737 Set refValueSet = getRefValueSetFrom(stmtsInAnnotation);
00738 for (Iterator valueIt = refValueSet.iterator(); valueIt.hasNext();) {
00739 Value value = (Value) valueIt.next();
00740 DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode(value);
00741 valueRoot.add(valueNode);
00742
00743 Collection valueSet = BOFA_Analysis.referenceValueSet(value, sootMethod);
00744 for (Iterator valueIt2 = valueSet.iterator(); valueIt2.hasNext();) {
00745 edu.ksu.cis.bandera.bofa.Analysis.ExprStmtMethodTriple valueTriple = (edu.ksu.cis.bandera.bofa.Analysis.ExprStmtMethodTriple) valueIt2.next();
00746 edu.ksu.cis.bandera.bofa.Analysis.StmtMethodPair stmtMethodPair = valueTriple.getStmtMethodPair();
00747 Stmt valueStmt = stmtMethodPair.getStmt();
00748 SootMethod valueMethod = stmtMethodPair.getSootMethod();
00749 if (valueStmt instanceof IdentityStmt) {
00750 ParameterNode paraNode = new ParameterNode(sootMethod.getDeclaringClass(), mda, (IdentityStmt) valueStmt);
00751 valueNode.add(new DefaultMutableTreeNode(paraNode));
00752 } else {
00753 Annotation valueStmtAnnotation = null;
00754 Annotation methodAnnotation = null;
00755 if (valueMethod.equals(sootMethod))
00756 methodAnnotation = mda;
00757 else
00758 methodAnnotation = CompilationManager.getAnnotationManager().getAnnotation(valueMethod.getDeclaringClass(), valueMethod);
00759 try {
00760 valueStmtAnnotation = methodAnnotation.getContainingAnnotation(valueStmt);
00761 } catch (AnnotationException ae) {
00762 System.out.println("there is an AnnotationException! And ddStmtAnnotation may be null");
00763 }
00764 if (!valueStmtAnnotation.toString().equals(""))
00765 valueNode.add(new DefaultMutableTreeNode(valueStmtAnnotation));
00766 }
00767 }
00768 }
00769 }
00770
00771
00772
00773 public void clearDependButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
00774 if (currentNode == null) {
00775 selectStatementWarning(getClearDependButton());
00776 return;
00777 }
00778 dependencyValueViewer.setState(Frame.NORMAL);
00779 dependencyValueViewer.toFront();
00780 isChangeCheckBoxByProgram = true;
00781 if (doPredDataDepend) {
00782 doPredDataDepend = false;
00783 getDataPredCheckBox().setSelected(false);
00784 }
00785 if (doPredControlDepend) {
00786 doPredControlDepend = false;
00787 getControlPredCheckBox().setSelected(false);
00788 }
00789 if (doPredReadyDepend) {
00790 doPredReadyDepend = false;
00791 getReadyPredCheckBox().setSelected(false);
00792 }
00793 if (doPredSynchDepend) {
00794 doPredSynchDepend = false;
00795 getSynchPredCheckBox().setSelected(false);
00796 }
00797 if (doPredInterferDepend) {
00798 doPredInterferDepend = false;
00799 getInterferPredCheckBox().setSelected(false);
00800 }
00801 if (doPredDivergentDepend) {
00802 doPredDivergentDepend = false;
00803 getDiverPredCheckBox().setSelected(false);
00804 }
00805 if (doSuccDataDepend) {
00806 doSuccDataDepend = false;
00807 getDataSuccCheckBox().setSelected(false);
00808 }
00809 if (doSuccControlDepend) {
00810 doSuccControlDepend = false;
00811 getControlSuccCheckBox().setSelected(false);
00812 }
00813 if (doSuccReadyDepend) {
00814 doSuccReadyDepend = false;
00815 getReadySuccCheckBox().setSelected(false);
00816 }
00817 if (doSuccSynchDepend) {
00818 doSuccSynchDepend = false;
00819 getSynchSuccCheckBox().setSelected(false);
00820 }
00821 if (doSuccInterferDepend) {
00822 doSuccInterferDepend = false;
00823 getInterferSuccCheckBox().setSelected(false);
00824 }
00825 if (doSuccDivergentDepend) {
00826 doSuccDivergentDepend = false;
00827 getDiverSuccCheckBox().setSelected(false);
00828 }
00829 isChangeCheckBoxByProgram = false;
00830
00831 dependencyValueViewer.currentDependTreeRoot = new DefaultMutableTreeNode(currentNode);
00832 dependencyValueViewer.getDependencyTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentDependTreeRoot));
00833 dependencyValueViewer.changeViewerState();
00834 return;
00835 }
00836
00837
00838
00839 public void clearToolBarButton_ActionEvents() {
00840 initializeConfig();
00841 currentMethodDecAnn = null;
00842 currentNode = null;
00843 currentPositionOfHistoryChain = -1;
00844 dependencyValueViewer.currentDependTreeRoot = null;
00845 dependencyValueViewer.currentValueTreeRoot = null;
00846 historyChain = new LinkedList();
00847 nodeToConfigTable = new Hashtable();
00848 getBackToolBarButton().setEnabled(false);
00849 getForwardToolBarButton().setEnabled(false);
00850 getClearToolBarButton().setEnabled(false);
00851 getBackwardSliceToolBarButton().setEnabled(false);
00852 getForwardSliceToolBarButton().setEnabled(false);
00853 isSetItemByProgram = true;
00854 try {
00855 getHistoryComboBox().removeAllItems();
00856 } catch (Exception e) {
00857 }
00858 isSetItemByProgram = false;
00859 dependencyValueViewer.getDependencyTree().setModel(new DefaultTreeModel(new DefaultMutableTreeNode("")));
00860 dependencyValueViewer.getValueTree().setModel(new DefaultTreeModel(new DefaultMutableTreeNode("")));
00861 return;
00862 }
00863
00864
00865
00866 public void clearValuesButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
00867 if (currentNode == null) {
00868 selectStatementWarning(getClearValuesButton());
00869 return;
00870 }
00871 dependencyValueViewer.setState(Frame.NORMAL);
00872 dependencyValueViewer.toFront();
00873 isChangeCheckBoxByProgram = true;
00874 if (doPredValue) {
00875 doPredValue = false;
00876 getValuePredCheckBox().setSelected(false);
00877 }
00878 if (doSuccValue) {
00879 doSuccValue = false;
00880 getValueSuccCheckBox().setSelected(false);
00881 }
00882 if (doSetValue) {
00883 doSetValue = false;
00884 getValueSetCheckBox().setSelected(false);
00885 }
00886 isChangeCheckBoxByProgram = false;
00887
00888 dependencyValueViewer.currentValueTreeRoot = new DefaultMutableTreeNode(currentNode);
00889 dependencyValueViewer.getValueTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentValueTreeRoot));
00890
00891
00892
00893 dependencyValueViewer.changeViewerState();
00894 return;
00895 }
00896
00897
00898
00899
00900
00901
00902 private Set collectVarsFromStmts(Stmt[] stmtsInAnnotation) {
00903 Set varSet = new ArraySet();
00904 for (int i = 0; i < stmtsInAnnotation.length; i++) {
00905 for (Iterator valueBoxIt = stmtsInAnnotation[i].getUseAndDefBoxes().iterator(); valueBoxIt.hasNext();) {
00906 ValueBox valueBox = (ValueBox) valueBoxIt.next();
00907 Value value = valueBox.getValue();
00908 if (value instanceof Local) {
00909 if (!((Local) value).getName().startsWith("JJJCTEMP") && !((Local) value).getName().startsWith("$"))
00910 varSet.add(value);
00911 } else
00912 if ((value instanceof InvokeExpr) || (value instanceof Constant) || (value instanceof BinopExpr) ||(value instanceof NewExpr)) {
00913 } else
00914 varSet.add(value);
00915 }
00916 }
00917 return varSet;
00918 }
00919
00920
00921
00922
00923
00924 private void compactHistoryChain(Object node) {
00925 int index = historyChain.indexOf(node);
00926 while (index >= 0) {
00927 historyChain.remove(index);
00928 currentPositionOfHistoryChain--;
00929 index = historyChain.indexOf(node);
00930 }
00931 }
00932
00933
00934
00935
00936
00937 private void connEtoC1(java.awt.event.WindowEvent arg1) {
00938 try {
00939
00940
00941 this.dependencies_WindowClosed(arg1);
00942
00943
00944 } catch (java.lang.Throwable ivjExc) {
00945
00946
00947 handleException(ivjExc);
00948 }
00949 }
00950
00951
00952
00953
00954
00955 private void connEtoC10(java.awt.event.ActionEvent arg1) {
00956 try {
00957
00958
00959 this.backToolBarButton_ActionPerformed(arg1);
00960
00961
00962 } catch (java.lang.Throwable ivjExc) {
00963
00964
00965 handleException(ivjExc);
00966 }
00967 }
00968
00969
00970
00971
00972
00973 private void connEtoC11(java.awt.event.ActionEvent arg1) {
00974 try {
00975
00976
00977 this.forwardToolBarButton_ActionPerformed(arg1);
00978
00979
00980 } catch (java.lang.Throwable ivjExc) {
00981
00982
00983 handleException(ivjExc);
00984 }
00985 }
00986
00987
00988
00989
00990
00991 private void connEtoC12(java.awt.event.ItemEvent arg1) {
00992 try {
00993
00994 if (!isChangeCheckBoxByProgram)
00995
00996
00997 this.dataSuccCheckBox_ItemStateChanged(arg1);
00998
00999
01000 } catch (java.lang.Throwable ivjExc) {
01001
01002
01003 handleException(ivjExc);
01004 }
01005 }
01006
01007
01008
01009
01010
01011 private void connEtoC13(java.awt.event.ItemEvent arg1) {
01012 try {
01013
01014 if (!isChangeCheckBoxByProgram)
01015
01016 this.controlPredCheckBox_ItemStateChanged(arg1);
01017
01018
01019 } catch (java.lang.Throwable ivjExc) {
01020
01021
01022 handleException(ivjExc);
01023 }
01024 }
01025
01026
01027
01028
01029 private void connEtoC14() {
01030 try {
01031
01032
01033 this.clearToolBarButton_ActionEvents();
01034
01035
01036 } catch (java.lang.Throwable ivjExc) {
01037
01038
01039 handleException(ivjExc);
01040 }
01041 }
01042
01043
01044
01045
01046 private void connEtoC15() {
01047 try {
01048
01049
01050 this.clearToolBarButton_ActionEvents();
01051
01052
01053 } catch (java.lang.Throwable ivjExc) {
01054
01055
01056 handleException(ivjExc);
01057 }
01058 }
01059
01060
01061
01062
01063
01064 private void connEtoC16(java.awt.event.ItemEvent arg1) {
01065 try {
01066
01067 if (!isChangeCheckBoxByProgram)
01068
01069 this.controlSuccCheckBox_ItemStateChanged(arg1);
01070
01071
01072 } catch (java.lang.Throwable ivjExc) {
01073
01074
01075 handleException(ivjExc);
01076 }
01077 }
01078
01079
01080
01081
01082
01083 private void connEtoC17(java.awt.event.ItemEvent arg1) {
01084 try {
01085
01086 if (!isChangeCheckBoxByProgram)
01087
01088 this.diverPredCheckBox_ItemStateChanged(arg1);
01089
01090
01091 } catch (java.lang.Throwable ivjExc) {
01092
01093
01094 handleException(ivjExc);
01095 }
01096 }
01097
01098
01099
01100
01101
01102 private void connEtoC18(java.awt.event.ItemEvent arg1) {
01103 try {
01104
01105 if (!isChangeCheckBoxByProgram)
01106
01107 this.diverSuccCheckBox_ItemStateChanged(arg1);
01108
01109
01110 } catch (java.lang.Throwable ivjExc) {
01111
01112
01113 handleException(ivjExc);
01114 }
01115 }
01116
01117
01118
01119
01120
01121 private void connEtoC19(java.awt.event.ItemEvent arg1) {
01122 try {
01123
01124 if (!isChangeCheckBoxByProgram)
01125
01126 this.readyPredCheckBox_ItemStateChanged(arg1);
01127
01128
01129 } catch (java.lang.Throwable ivjExc) {
01130
01131
01132 handleException(ivjExc);
01133 }
01134 }
01135
01136
01137
01138
01139 private void connEtoC2() {
01140 try {
01141
01142
01143 this.backwardSliceToolBarButton_ActionEvents();
01144
01145
01146 } catch (java.lang.Throwable ivjExc) {
01147
01148
01149 handleException(ivjExc);
01150 }
01151 }
01152
01153
01154
01155
01156
01157 private void connEtoC20(java.awt.event.ItemEvent arg1) {
01158 try {
01159
01160 if (!isChangeCheckBoxByProgram)
01161
01162 this.readySuccCheckBox_ItemStateChanged(arg1);
01163
01164
01165 } catch (java.lang.Throwable ivjExc) {
01166
01167
01168 handleException(ivjExc);
01169 }
01170 }
01171
01172
01173
01174
01175
01176 private void connEtoC21(java.awt.event.ItemEvent arg1) {
01177 try {
01178
01179 if (!isChangeCheckBoxByProgram)
01180
01181 this.interferPredCheckBox_ItemStateChanged(arg1);
01182
01183
01184 } catch (java.lang.Throwable ivjExc) {
01185
01186
01187 handleException(ivjExc);
01188 }
01189 }
01190
01191
01192
01193
01194
01195 private void connEtoC22(java.awt.event.ItemEvent arg1) {
01196 try {
01197
01198 if (!isChangeCheckBoxByProgram)
01199
01200 this.interferSuccCheckBox_ItemStateChanged(arg1);
01201
01202
01203 } catch (java.lang.Throwable ivjExc) {
01204
01205
01206 handleException(ivjExc);
01207 }
01208 }
01209
01210
01211
01212
01213
01214 private void connEtoC23(java.awt.event.ItemEvent arg1) {
01215 try {
01216
01217 if (!isChangeCheckBoxByProgram)
01218
01219 this.synchPredCheckBox_ItemStateChanged(arg1);
01220
01221
01222 } catch (java.lang.Throwable ivjExc) {
01223
01224
01225 handleException(ivjExc);
01226 }
01227 }
01228
01229
01230
01231
01232
01233 private void connEtoC24(java.awt.event.ItemEvent arg1) {
01234 try {
01235
01236 if (!isChangeCheckBoxByProgram)
01237
01238 this.synchSuccCheckBox_ItemStateChanged(arg1);
01239
01240
01241 } catch (java.lang.Throwable ivjExc) {
01242
01243
01244 handleException(ivjExc);
01245 }
01246 }
01247
01248
01249
01250
01251
01252 private void connEtoC25(java.awt.event.ItemEvent arg1) {
01253 try {
01254
01255 if (!isChangeCheckBoxByProgram)
01256
01257 this.valuePredCheckBox_ItemStateChanged(arg1);
01258
01259
01260 } catch (java.lang.Throwable ivjExc) {
01261
01262
01263 handleException(ivjExc);
01264 }
01265 }
01266
01267
01268
01269
01270
01271 private void connEtoC26(java.awt.event.ItemEvent arg1) {
01272 try {
01273
01274 if (!isChangeCheckBoxByProgram)
01275
01276 this.valueSuccCheckBox_ItemStateChanged(arg1);
01277
01278
01279 } catch (java.lang.Throwable ivjExc) {
01280
01281
01282 handleException(ivjExc);
01283 }
01284 }
01285
01286
01287
01288
01289
01290 private void connEtoC27(java.awt.event.ItemEvent arg1) {
01291 try {
01292
01293 if (!isChangeCheckBoxByProgram)
01294
01295 this.valueSetCheckBox_ItemStateChanged(arg1);
01296
01297
01298 } catch (java.lang.Throwable ivjExc) {
01299
01300
01301 handleException(ivjExc);
01302 }
01303 }
01304
01305
01306
01307
01308
01309 private void connEtoC28(java.awt.event.ActionEvent arg1) {
01310 try {
01311
01312
01313 this.allpredButton_ActionPerformed(arg1);
01314
01315
01316 } catch (java.lang.Throwable ivjExc) {
01317
01318
01319 handleException(ivjExc);
01320 }
01321 }
01322
01323
01324
01325
01326
01327 private void connEtoC29(java.awt.event.ActionEvent arg1) {
01328 try {
01329
01330
01331 this.allsuccButton_ActionPerformed(arg1);
01332
01333
01334 } catch (java.lang.Throwable ivjExc) {
01335
01336
01337 handleException(ivjExc);
01338 }
01339 }
01340
01341
01342
01343
01344
01345 private void connEtoC30(java.awt.event.ActionEvent arg1) {
01346 try {
01347
01348
01349 this.allDependButton_ActionPerformed(arg1);
01350
01351
01352 } catch (java.lang.Throwable ivjExc) {
01353
01354
01355 handleException(ivjExc);
01356 }
01357 }
01358
01359
01360
01361
01362
01363 private void connEtoC31(java.awt.event.ActionEvent arg1) {
01364 try {
01365
01366
01367 this.nopredButton_ActionPerformed(arg1);
01368
01369
01370 } catch (java.lang.Throwable ivjExc) {
01371
01372
01373 handleException(ivjExc);
01374 }
01375 }
01376
01377
01378
01379
01380
01381 private void connEtoC32(java.awt.event.ActionEvent arg1) {
01382 try {
01383
01384
01385 this.nosuccButton_ActionPerformed(arg1);
01386
01387
01388 } catch (java.lang.Throwable ivjExc) {
01389
01390
01391 handleException(ivjExc);
01392 }
01393 }
01394
01395
01396
01397
01398
01399 private void connEtoC33(java.awt.event.ActionEvent arg1) {
01400 try {
01401
01402
01403 this.clearDependButton_ActionPerformed(arg1);
01404
01405
01406 } catch (java.lang.Throwable ivjExc) {
01407
01408
01409 handleException(ivjExc);
01410 }
01411 }
01412
01413
01414
01415
01416
01417 private void connEtoC34(java.awt.event.ActionEvent arg1) {
01418 try {
01419
01420
01421 this.allValuesButton_ActionPerformed(arg1);
01422
01423
01424 } catch (java.lang.Throwable ivjExc) {
01425
01426
01427 handleException(ivjExc);
01428 }
01429 }
01430
01431
01432
01433
01434
01435 private void connEtoC35(java.awt.event.ActionEvent arg1) {
01436 try {
01437
01438
01439 this.clearValuesButton_ActionPerformed(arg1);
01440
01441
01442 } catch (java.lang.Throwable ivjExc) {
01443
01444
01445 handleException(ivjExc);
01446 }
01447 }
01448
01449
01450
01451
01452
01453 private void connEtoC8(java.awt.event.ItemEvent arg1) {
01454 try {
01455
01456 if (!isChangeCheckBoxByProgram)
01457
01458 this.dataPredCheckBox_ItemStateChanged(arg1);
01459
01460
01461 } catch (java.lang.Throwable ivjExc) {
01462
01463
01464 handleException(ivjExc);
01465 }
01466 }
01467
01468
01469
01470
01471 private void connEtoC9() {
01472 try {
01473
01474 if (!isSetItemByProgram)
01475
01476 this.historyComboBox_ActionEvents();
01477
01478
01479 } catch (java.lang.Throwable ivjExc) {
01480
01481
01482 handleException(ivjExc);
01483 }
01484 }
01485
01486
01487
01488 public void controlPredCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
01489 if (currentNode == null) {
01490 selectStatementWarning(getControlPredCheckBox());
01491 return;
01492 }
01493 dependencyValueViewer.setState(Frame.NORMAL);
01494 dependencyValueViewer.toFront();
01495 doPredControlDepend = !doPredControlDepend;
01496 if (!doPredControlDepend) {
01497 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01498
01499
01500 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01501 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01502 if (oneChild.toString().equals("Control Dependence")) {
01503 if (oneChild.getChildCount() == 1) {
01504 treeModel.removeNodeFromParent(oneChild);
01505 break;
01506 } else {
01507 for (int j = 0; j < oneChild.getChildCount(); j++) {
01508 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
01509 if (predSuccChild.toString().equals("Predecessors")) {
01510 treeModel.removeNodeFromParent(predSuccChild);
01511 break;
01512 }
01513 }
01514 }
01515 break;
01516 }
01517 }
01518 } else {
01519 boolean isDependency = true;
01520 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01521 DefaultMutableTreeNode currentControlRoot = null;
01522 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01523 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01524 if (oneChild.toString().equals("Control Dependence")) {
01525 currentControlRoot = oneChild;
01526 break;
01527 }
01528 }
01529 if (currentControlRoot == null) {
01530 currentControlRoot = new DefaultMutableTreeNode("Control Dependence");
01531 int insertIndex = dependencyValueViewer.getInsertIndexOf("Control Dependence", isDependency);
01532 treeModel.insertNodeInto(currentControlRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
01533 }
01534 DefaultMutableTreeNode controlPredTreeNode = getControlDependAnns(true);
01535 if (controlPredTreeNode != null) {
01536
01537 treeModel.insertNodeInto(controlPredTreeNode, currentControlRoot, 0);
01538
01539 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(controlPredTreeNode.getPath()));
01540
01541
01542
01543
01544 dependencyValueViewer.expandAndCollapseFrom(controlPredTreeNode, isDependency);
01545 }
01546 }
01547
01548 dependencyValueViewer.changeViewerState();
01549 return;
01550 }
01551
01552
01553
01554 public void controlSuccCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
01555 if (currentNode == null) {
01556 selectStatementWarning(getControlSuccCheckBox());
01557 return;
01558 }
01559 dependencyValueViewer.setState(Frame.NORMAL);
01560 dependencyValueViewer.toFront();
01561 doSuccControlDepend = !doSuccControlDepend;
01562 if (!doSuccControlDepend) {
01563 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01564
01565
01566 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01567 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01568 if (oneChild.toString().equals("Control Dependence")) {
01569 if (oneChild.getChildCount() == 1) {
01570 treeModel.removeNodeFromParent(oneChild);
01571 break;
01572 } else {
01573 for (int j = 0; j < oneChild.getChildCount(); j++) {
01574 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
01575 if (predSuccChild.toString().equals("Successors")) {
01576 treeModel.removeNodeFromParent(predSuccChild);
01577 break;
01578 }
01579 }
01580 }
01581 break;
01582 }
01583 }
01584 } else {
01585 boolean isDependency = true;
01586 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01587 DefaultMutableTreeNode currentControlRoot = null;
01588 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01589 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01590 if (oneChild.toString().equals("Control Dependence")) {
01591 currentControlRoot = oneChild;
01592 break;
01593 }
01594 }
01595 if (currentControlRoot == null) {
01596 currentControlRoot = new DefaultMutableTreeNode("Control Dependence");
01597 int insertIndex = dependencyValueViewer.getInsertIndexOf("Control Dependence", isDependency);
01598 treeModel.insertNodeInto(currentControlRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
01599 }
01600 DefaultMutableTreeNode controlSuccTreeNode = getControlDependAnns(false);
01601 if (controlSuccTreeNode != null) {
01602
01603 treeModel.insertNodeInto(controlSuccTreeNode, currentControlRoot, currentControlRoot.getChildCount());
01604
01605 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(controlSuccTreeNode.getPath()));
01606
01607
01608
01609
01610 dependencyValueViewer.expandAndCollapseFrom(controlSuccTreeNode, isDependency);
01611 }
01612 }
01613
01614
01615 dependencyValueViewer.changeViewerState();
01616 return;
01617 }
01618
01619
01620
01621 public void dataPredCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
01622 if (currentNode == null) {
01623 selectStatementWarning(getDataPredCheckBox());
01624 return;
01625 }
01626 dependencyValueViewer.setState(Frame.NORMAL);
01627 dependencyValueViewer.toFront();
01628 doPredDataDepend = !doPredDataDepend;
01629
01630 if (!doPredDataDepend) {
01631 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01632
01633
01634 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01635 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01636 if (oneChild.toString().equals("Data Dependence")) {
01637 if (oneChild.getChildCount() == 1) {
01638 treeModel.removeNodeFromParent(oneChild);
01639 break;
01640 } else {
01641 for (int j = 0; j < oneChild.getChildCount(); j++) {
01642 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
01643 if (predSuccChild.toString().equals("Predecessors")) {
01644 treeModel.removeNodeFromParent(predSuccChild);
01645 break;
01646 }
01647 }
01648 }
01649 break;
01650 }
01651 }
01652 } else {
01653 boolean isDependency = true;
01654 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01655 DefaultMutableTreeNode currentDataRoot = null;
01656 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01657 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01658 if (oneChild.toString().equals("Data Dependence")) {
01659 currentDataRoot = oneChild;
01660 break;
01661 }
01662 }
01663 if (currentDataRoot == null) {
01664 currentDataRoot = new DefaultMutableTreeNode("Data Dependence");
01665 int insertIndex = dependencyValueViewer.getInsertIndexOf("Data Dependence",isDependency);
01666 treeModel.insertNodeInto(currentDataRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
01667 }
01668 DefaultMutableTreeNode dataPredTreeNode = getDataDependAnns(true);
01669 if (dataPredTreeNode != null) {
01670
01671 treeModel.insertNodeInto(dataPredTreeNode, currentDataRoot, 0);
01672
01673 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dataPredTreeNode.getPath()));
01674
01675
01676
01677
01678 dependencyValueViewer.expandAndCollapseFrom(dataPredTreeNode, isDependency);
01679 }
01680 }
01681
01682 dependencyValueViewer.changeViewerState();
01683 return;
01684 }
01685
01686
01687
01688 public void dataSuccCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
01689 if (currentNode == null) {
01690 selectStatementWarning(getDataSuccCheckBox());
01691 return;
01692 }
01693 dependencyValueViewer.setState(Frame.NORMAL);
01694 dependencyValueViewer.toFront();
01695 doSuccDataDepend = !doSuccDataDepend;
01696 if (!doSuccDataDepend) {
01697 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01698
01699
01700 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01701 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01702 if (oneChild.toString().equals("Data Dependence")) {
01703 if (oneChild.getChildCount() == 1) {
01704 treeModel.removeNodeFromParent(oneChild);
01705 break;
01706 } else {
01707 for (int j = 0; j < oneChild.getChildCount(); j++) {
01708 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
01709 if (predSuccChild.toString().equals("Successors")) {
01710 treeModel.removeNodeFromParent(predSuccChild);
01711 break;
01712 }
01713 }
01714 }
01715 break;
01716 }
01717 }
01718 } else {
01719 boolean isDependency = true;
01720 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01721 DefaultMutableTreeNode currentDataRoot = null;
01722 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01723 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01724 if (oneChild.toString().equals("Data Dependence")) {
01725 currentDataRoot = oneChild;
01726 break;
01727 }
01728 }
01729 if (currentDataRoot == null) {
01730 currentDataRoot = new DefaultMutableTreeNode("Data Dependence");
01731 int insertIndex = dependencyValueViewer.getInsertIndexOf("Data Dependence",isDependency);
01732 treeModel.insertNodeInto(currentDataRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
01733 }
01734 DefaultMutableTreeNode dataSuccTreeNode = getDataDependAnns(false);
01735 if (dataSuccTreeNode != null) {
01736
01737 treeModel.insertNodeInto(dataSuccTreeNode, currentDataRoot, currentDataRoot.getChildCount());
01738
01739 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(dataSuccTreeNode.getPath()));
01740
01741
01742
01743
01744 dependencyValueViewer.expandAndCollapseFrom(dataSuccTreeNode, isDependency);
01745 }
01746 }
01747
01748 dependencyValueViewer.changeViewerState();
01749 return;
01750 }
01751
01752
01753
01754 public void dependencies_WindowClosed(java.awt.event.WindowEvent windowEvent) {
01755 Dependencies.dependFrame = null;
01756 dependencyValueViewer.dispose();
01757 return;
01758 }
01759
01760
01761
01762 public void diverPredCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
01763 if (currentNode == null) {
01764 selectStatementWarning(getDiverPredCheckBox());
01765 return;
01766 }
01767 dependencyValueViewer.setState(Frame.NORMAL);
01768 dependencyValueViewer.toFront();
01769 doPredDivergentDepend = !doPredDivergentDepend;
01770 if (!doPredDivergentDepend) {
01771 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01772
01773
01774 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01775 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01776 if (oneChild.toString().equals("Divergent Dependence")) {
01777 if (oneChild.getChildCount() == 1) {
01778 treeModel.removeNodeFromParent(oneChild);
01779 break;
01780 } else {
01781 for (int j = 0; j < oneChild.getChildCount(); j++) {
01782 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
01783 if (predSuccChild.toString().equals("Predecessors")) {
01784 treeModel.removeNodeFromParent(predSuccChild);
01785 break;
01786 }
01787 }
01788 }
01789 break;
01790 }
01791 }
01792 } else {
01793 boolean isDependency = true;
01794 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01795 DefaultMutableTreeNode currentDivergentRoot = null;
01796 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01797 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01798 if (oneChild.toString().equals("Divergent Dependence")) {
01799 currentDivergentRoot = oneChild;
01800 break;
01801 }
01802 }
01803 if (currentDivergentRoot == null) {
01804 currentDivergentRoot = new DefaultMutableTreeNode("Divergent Dependence");
01805 int insertIndex = dependencyValueViewer.getInsertIndexOf("Divergent Dependence", isDependency);
01806 treeModel.insertNodeInto(currentDivergentRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
01807 }
01808 DefaultMutableTreeNode divergentPredTreeNode = getDivergentDependAnns(true);
01809 if (divergentPredTreeNode != null) {
01810
01811 treeModel.insertNodeInto(divergentPredTreeNode, currentDivergentRoot, 0);
01812
01813 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(divergentPredTreeNode.getPath()));
01814
01815
01816
01817
01818 dependencyValueViewer.expandAndCollapseFrom(divergentPredTreeNode, isDependency);
01819 }
01820 }
01821
01822 dependencyValueViewer.changeViewerState();
01823 return;
01824 }
01825
01826
01827
01828 public void diverSuccCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
01829 if (currentNode == null) {
01830 selectStatementWarning(getDiverSuccCheckBox());
01831 return;
01832 }
01833 dependencyValueViewer.setState(Frame.NORMAL);
01834 dependencyValueViewer.toFront();
01835 doSuccDivergentDepend = !doSuccDivergentDepend;
01836 if (!doSuccDivergentDepend) {
01837 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01838
01839
01840 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01841 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01842 if (oneChild.toString().equals("Divergent Dependence")) {
01843 if (oneChild.getChildCount() == 1) {
01844 treeModel.removeNodeFromParent(oneChild);
01845 break;
01846 } else {
01847 for (int j = 0; j < oneChild.getChildCount(); j++) {
01848 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
01849 if (predSuccChild.toString().equals("Successors")) {
01850 treeModel.removeNodeFromParent(predSuccChild);
01851 break;
01852 }
01853 }
01854 }
01855 break;
01856 }
01857 }
01858 } else {
01859 boolean isDependency = true;
01860 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
01861 DefaultMutableTreeNode currentDivergentRoot = null;
01862 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
01863 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
01864 if (oneChild.toString().equals("Divergent Dependence")) {
01865 currentDivergentRoot = oneChild;
01866 break;
01867 }
01868 }
01869 if (currentDivergentRoot == null) {
01870 currentDivergentRoot = new DefaultMutableTreeNode("Divergent Dependence");
01871 int insertIndex = dependencyValueViewer.getInsertIndexOf("Divergent Dependence", isDependency);
01872 treeModel.insertNodeInto(currentDivergentRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
01873 }
01874 DefaultMutableTreeNode divergentSuccTreeNode = getDivergentDependAnns(false);
01875 if (divergentSuccTreeNode != null) {
01876
01877 treeModel.insertNodeInto(divergentSuccTreeNode, currentDivergentRoot, currentDivergentRoot.getChildCount());
01878
01879 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(divergentSuccTreeNode.getPath()));
01880
01881
01882
01883
01884 dependencyValueViewer.expandAndCollapseFrom(divergentSuccTreeNode, isDependency);
01885 }
01886 }
01887
01888
01889 dependencyValueViewer.changeViewerState();
01890 return;
01891 }
01892
01893
01894
01895
01896
01897 boolean doDepends() {
01898 if (doSuccDataDepend || doPredDataDepend || doSuccControlDepend || doPredControlDepend || doSuccReadyDepend || doPredReadyDepend || doSuccSynchDepend || doPredSynchDepend || doSuccInterferDepend || doPredInterferDepend || doSuccDivergentDepend || doPredDivergentDepend)
01899 return true;
01900 return false;
01901 }
01902
01903
01904
01905
01906
01907 private boolean doDependsInConfig(Configuration config) {
01908 if (config.dataSucc|| config.dataPred || config.controlSucc || config.controlPred || config.readySucc || config.readyPred || config.synchSucc || config.synchPred || config.interferSucc || config.interferPred || config.divergentSucc || config.divergentPred)
01909 return true;
01910 return false;
01911 }
01912
01913
01914
01915
01916
01917 boolean doValues() {
01918 if (doPredValue || doSuccValue || doSetValue)
01919 return true;
01920 return false;
01921 }
01922
01923
01924
01925
01926
01927 private boolean doValuesInConfig(Configuration config) {
01928 if (config.valuePred || config.valueSucc || config.valueSet)
01929 return true;
01930 return false;
01931 }
01932 private Set enterSetEffectedBy(MethodInfo methodInfo, Set exitMonitors){
01933
01934 Set enterSet = new ArraySet();
01935 BuildPDG methodPDG = methodInfo.methodPDG;
01936 Map readyDependMap = methodPDG.getReadyDependMap();
01937 if (readyDependMap == null)
01938 return enterSet;
01939
01940 for (Iterator keyIt = readyDependMap.keySet().iterator(); keyIt.hasNext();) {
01941 Stmt keyStmt = (Stmt) keyIt.next();
01942 List readyOnList = (List) readyDependMap.get(keyStmt);
01943 if (readyOnListContains(readyOnList, exitMonitors))
01944 enterSet.add(keyStmt);
01945 }
01946 return enterSet;
01947 }
01948
01949
01950
01951 public void forwardToolBarButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
01952 dependencyValueViewer.setState(Frame.NORMAL);
01953 dependencyValueViewer.toFront();
01954
01955 Configuration config = getCurrentConfig();
01956 nodeToConfigTable.put(currentNode, config);
01957
01958 ++currentPositionOfHistoryChain;
01959 currentNode = historyChain.get(currentPositionOfHistoryChain);
01960 config = (Configuration) nodeToConfigTable.get(currentNode);
01961 restoreConfig(config);
01962 isSetItemByProgram = true;
01963 getHistoryComboBox().setSelectedItem(currentNode);
01964 isSetItemByProgram = false;
01965 if (currentPositionOfHistoryChain == (historyChain.size() - 1))
01966 getForwardToolBarButton().setEnabled(false);
01967 if (!getBackToolBarButton().isEnabled())
01968 getBackToolBarButton().setEnabled(true);
01969 return;
01970 }
01971
01972
01973
01974
01975
01976 private javax.swing.JButton getAllDependButton() {
01977 if (ivjAllDependButton == null) {
01978 try {
01979 ivjAllDependButton = new javax.swing.JButton();
01980 ivjAllDependButton.setName("AllDependButton");
01981 ivjAllDependButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/all.jpg")));
01982 ivjAllDependButton.setBorder(new javax.swing.border.CompoundBorder());
01983 ivjAllDependButton.setText("");
01984 ivjAllDependButton.setBackground(new java.awt.Color(204,204,255));
01985
01986
01987 } catch (java.lang.Throwable ivjExc) {
01988
01989
01990 handleException(ivjExc);
01991 }
01992 }
01993 return ivjAllDependButton;
01994 }
01995
01996
01997
01998
01999
02000 private javax.swing.JButton getAllpredButton() {
02001 if (ivjAllpredButton == null) {
02002 try {
02003 ivjAllpredButton = new javax.swing.JButton();
02004 ivjAllpredButton.setName("AllpredButton");
02005 ivjAllpredButton.setBorder(new javax.swing.border.CompoundBorder());
02006 ivjAllpredButton.setText("All pred");
02007 ivjAllpredButton.setBackground(new java.awt.Color(204,204,255));
02008 ivjAllpredButton.setFont(new java.awt.Font("dialog.plain", 0, 12));
02009 ivjAllpredButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
02010
02011
02012 } catch (java.lang.Throwable ivjExc) {
02013
02014
02015 handleException(ivjExc);
02016 }
02017 }
02018 return ivjAllpredButton;
02019 }
02020
02021
02022
02023
02024
02025 private javax.swing.JButton getAllsuccButton() {
02026 if (ivjAllsuccButton == null) {
02027 try {
02028 ivjAllsuccButton = new javax.swing.JButton();
02029 ivjAllsuccButton.setName("AllsuccButton");
02030 ivjAllsuccButton.setBorder(new javax.swing.border.CompoundBorder());
02031 ivjAllsuccButton.setText("All succ");
02032 ivjAllsuccButton.setBackground(new java.awt.Color(204,204,255));
02033 ivjAllsuccButton.setFont(new java.awt.Font("dialog.plain", 0, 12));
02034 ivjAllsuccButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
02035
02036
02037 } catch (java.lang.Throwable ivjExc) {
02038
02039
02040 handleException(ivjExc);
02041 }
02042 }
02043 return ivjAllsuccButton;
02044 }
02045
02046
02047
02048
02049
02050 private javax.swing.JButton getAllValuesButton() {
02051 if (ivjAllValuesButton == null) {
02052 try {
02053 ivjAllValuesButton = new javax.swing.JButton();
02054 ivjAllValuesButton.setName("AllValuesButton");
02055 ivjAllValuesButton.setBorder(new javax.swing.border.CompoundBorder());
02056 ivjAllValuesButton.setFont(new java.awt.Font("dialog.plain", 0, 12));
02057 ivjAllValuesButton.setText("All values");
02058 ivjAllValuesButton.setBackground(new java.awt.Color(204,204,255));
02059
02060
02061 } catch (java.lang.Throwable ivjExc) {
02062
02063
02064 handleException(ivjExc);
02065 }
02066 }
02067 return ivjAllValuesButton;
02068 }
02069
02070
02071
02072
02073
02074 private javax.swing.JButton getBackToolBarButton() {
02075 if (ivjBackToolBarButton == null) {
02076 try {
02077 ivjBackToolBarButton = new javax.swing.JButton();
02078 ivjBackToolBarButton.setName("BackToolBarButton");
02079 ivjBackToolBarButton.setBorder(new javax.swing.border.CompoundBorder());
02080 ivjBackToolBarButton.setText("back");
02081 ivjBackToolBarButton.setBackground(new java.awt.Color(204,204,255));
02082 ivjBackToolBarButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
02083 ivjBackToolBarButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
02084 ivjBackToolBarButton.setIcon(null);
02085 ivjBackToolBarButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
02086 ivjBackToolBarButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
02087 ivjBackToolBarButton.setEnabled(false);
02088
02089
02090 } catch (java.lang.Throwable ivjExc) {
02091
02092
02093 handleException(ivjExc);
02094 }
02095 }
02096 return ivjBackToolBarButton;
02097 }
02098
02099
02100
02101
02102
02103 public javax.swing.JButton getBackwardSliceToolBarButton() {
02104 if (ivjBackwardSliceToolBarButton == null) {
02105 try {
02106 ivjBackwardSliceToolBarButton = new javax.swing.JButton();
02107 ivjBackwardSliceToolBarButton.setName("BackwardSliceToolBarButton");
02108 ivjBackwardSliceToolBarButton.setBorder(new javax.swing.border.CompoundBorder());
02109 ivjBackwardSliceToolBarButton.setText("B-Slice");
02110 ivjBackwardSliceToolBarButton.setBackground(new java.awt.Color(204,204,255));
02111 ivjBackwardSliceToolBarButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
02112 ivjBackwardSliceToolBarButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
02113 ivjBackwardSliceToolBarButton.setIcon(null);
02114 ivjBackwardSliceToolBarButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
02115 ivjBackwardSliceToolBarButton.setEnabled(false);
02116
02117
02118 } catch (java.lang.Throwable ivjExc) {
02119
02120
02121 handleException(ivjExc);
02122 }
02123 }
02124 return ivjBackwardSliceToolBarButton;
02125 }
02126
02127
02128
02129
02130 private static void getBuilderData() {
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171
02172
02173
02174
02175
02176
02177
02178
02179
02180
02181
02182
02183
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245
02246
02247
02248
02249
02250 }
02251
02252
02253
02254
02255
02256 private javax.swing.JPanel getCheckBoxesPanel() {
02257 if (ivjCheckBoxesPanel == null) {
02258 try {
02259 ivjCheckBoxesPanel = new javax.swing.JPanel();
02260 ivjCheckBoxesPanel.setName("CheckBoxesPanel");
02261 ivjCheckBoxesPanel.setBorder(new javax.swing.border.EtchedBorder());
02262 ivjCheckBoxesPanel.setLayout(new java.awt.GridBagLayout());
02263 ivjCheckBoxesPanel.setBackground(new java.awt.Color(204,204,255));
02264 ivjCheckBoxesPanel.setPreferredSize(new java.awt.Dimension(500, 600));
02265 ivjCheckBoxesPanel.setMinimumSize(new java.awt.Dimension(500, 600));
02266
02267 java.awt.GridBagConstraints constraintsHistoryComboBox = new java.awt.GridBagConstraints();
02268 constraintsHistoryComboBox.gridx = 1; constraintsHistoryComboBox.gridy = 0;
02269 constraintsHistoryComboBox.gridwidth = 63;
02270 constraintsHistoryComboBox.fill = java.awt.GridBagConstraints.HORIZONTAL;
02271 constraintsHistoryComboBox.weightx = 1.0;
02272 constraintsHistoryComboBox.insets = new java.awt.Insets(4, 4, 4, 4);
02273 getCheckBoxesPanel().add(getHistoryComboBox(), constraintsHistoryComboBox);
02274
02275 java.awt.GridBagConstraints constraintsCurrentStmtLabel = new java.awt.GridBagConstraints();
02276 constraintsCurrentStmtLabel.gridx = 0; constraintsCurrentStmtLabel.gridy = 0;
02277 constraintsCurrentStmtLabel.fill = java.awt.GridBagConstraints.HORIZONTAL;
02278 constraintsCurrentStmtLabel.insets = new java.awt.Insets(4, 4, 4, 4);
02279 getCheckBoxesPanel().add(getCurrentStmtLabel(), constraintsCurrentStmtLabel);
02280
02281 java.awt.GridBagConstraints constraintsValueFlowLabel = new java.awt.GridBagConstraints();
02282 constraintsValueFlowLabel.gridx = 0; constraintsValueFlowLabel.gridy = 4;
02283 constraintsValueFlowLabel.fill = java.awt.GridBagConstraints.HORIZONTAL;
02284 constraintsValueFlowLabel.insets = new java.awt.Insets(4, 4, 4, 4);
02285 getCheckBoxesPanel().add(getValueFlowLabel(), constraintsValueFlowLabel);
02286
02287 java.awt.GridBagConstraints constraintsValueCheckBoxesPanel = new java.awt.GridBagConstraints();
02288 constraintsValueCheckBoxesPanel.gridx = 1; constraintsValueCheckBoxesPanel.gridy = 4;
02289 constraintsValueCheckBoxesPanel.gridwidth = 8;
02290 constraintsValueCheckBoxesPanel.fill = java.awt.GridBagConstraints.BOTH;
02291 constraintsValueCheckBoxesPanel.weightx = 1.0;
02292 constraintsValueCheckBoxesPanel.insets = new java.awt.Insets(4, 0, 4, 4);
02293 getCheckBoxesPanel().add(getValueCheckBoxesPanel(), constraintsValueCheckBoxesPanel);
02294
02295 java.awt.GridBagConstraints constraintsDependLabel = new java.awt.GridBagConstraints();
02296 constraintsDependLabel.gridx = 0; constraintsDependLabel.gridy = 1;
02297 constraintsDependLabel.fill = java.awt.GridBagConstraints.HORIZONTAL;
02298 constraintsDependLabel.insets = new java.awt.Insets(12, 4, 4, 4);
02299 getCheckBoxesPanel().add(getDependLabel(), constraintsDependLabel);
02300
02301 java.awt.GridBagConstraints constraintsDpredLabel = new java.awt.GridBagConstraints();
02302 constraintsDpredLabel.gridx = 0; constraintsDpredLabel.gridy = 2;
02303 constraintsDpredLabel.fill = java.awt.GridBagConstraints.HORIZONTAL;
02304 constraintsDpredLabel.anchor = java.awt.GridBagConstraints.EAST;
02305 constraintsDpredLabel.insets = new java.awt.Insets(12, 4, 4, 0);
02306 getCheckBoxesPanel().add(getDpredLabel(), constraintsDpredLabel);
02307
02308 java.awt.GridBagConstraints constraintsDsuccLabel = new java.awt.GridBagConstraints();
02309 constraintsDsuccLabel.gridx = 0; constraintsDsuccLabel.gridy = 3;
02310 constraintsDsuccLabel.fill = java.awt.GridBagConstraints.HORIZONTAL;
02311 constraintsDsuccLabel.anchor = java.awt.GridBagConstraints.EAST;
02312 constraintsDsuccLabel.insets = new java.awt.Insets(4, 4, 5, 0);
02313 getCheckBoxesPanel().add(getDsuccLabel(), constraintsDsuccLabel);
02314
02315 java.awt.GridBagConstraints constraintsDependCheckBoxesPanel = new java.awt.GridBagConstraints();
02316 constraintsDependCheckBoxesPanel.gridx = 8; constraintsDependCheckBoxesPanel.gridy = 1;
02317 constraintsDependCheckBoxesPanel.gridheight = 3;
02318 constraintsDependCheckBoxesPanel.fill = java.awt.GridBagConstraints.BOTH;
02319 constraintsDependCheckBoxesPanel.weightx = 1.0;
02320 constraintsDependCheckBoxesPanel.weighty = 1.0;
02321 constraintsDependCheckBoxesPanel.insets = new java.awt.Insets(4, 0, 4, 4);
02322 getCheckBoxesPanel().add(getDependCheckBoxesPanel(), constraintsDependCheckBoxesPanel);
02323
02324
02325 } catch (java.lang.Throwable ivjExc) {
02326
02327
02328 handleException(ivjExc);
02329 }
02330 }
02331 return ivjCheckBoxesPanel;
02332 }
02333
02334
02335
02336
02337
02338 private javax.swing.JButton getClearDependButton() {
02339 if (ivjClearDependButton == null) {
02340 try {
02341 ivjClearDependButton = new javax.swing.JButton();
02342 ivjClearDependButton.setName("ClearDependButton");
02343 ivjClearDependButton.setBorder(new javax.swing.border.CompoundBorder());
02344 ivjClearDependButton.setText("");
02345 ivjClearDependButton.setBackground(new java.awt.Color(204,204,255));
02346 ivjClearDependButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/clear.jpg")));
02347 ivjClearDependButton.setFont(new java.awt.Font("dialog.plain", 0, 12));
02348 ivjClearDependButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
02349
02350
02351 } catch (java.lang.Throwable ivjExc) {
02352
02353
02354 handleException(ivjExc);
02355 }
02356 }
02357 return ivjClearDependButton;
02358 }
02359
02360
02361
02362
02363
02364 private javax.swing.JButton getClearToolBarButton() {
02365 if (ivjClearToolBarButton == null) {
02366 try {
02367 ivjClearToolBarButton = new javax.swing.JButton();
02368 ivjClearToolBarButton.setName("ClearToolBarButton");
02369 ivjClearToolBarButton.setBorder(new javax.swing.border.CompoundBorder());
02370 ivjClearToolBarButton.setText("clear");
02371 ivjClearToolBarButton.setBackground(new java.awt.Color(204,204,255));
02372 ivjClearToolBarButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
02373 ivjClearToolBarButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
02374 ivjClearToolBarButton.setIcon(null);
02375 ivjClearToolBarButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
02376 ivjClearToolBarButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
02377 ivjClearToolBarButton.setEnabled(false);
02378
02379
02380 } catch (java.lang.Throwable ivjExc) {
02381
02382
02383 handleException(ivjExc);
02384 }
02385 }
02386 return ivjClearToolBarButton;
02387 }
02388
02389
02390
02391
02392
02393 private javax.swing.JButton getClearValuesButton() {
02394 if (ivjClearValuesButton == null) {
02395 try {
02396 ivjClearValuesButton = new javax.swing.JButton();
02397 ivjClearValuesButton.setName("ClearValuesButton");
02398 ivjClearValuesButton.setBorder(new javax.swing.border.CompoundBorder());
02399 ivjClearValuesButton.setText("clear");
02400 ivjClearValuesButton.setBackground(new java.awt.Color(204,204,255));
02401 ivjClearValuesButton.setFont(new java.awt.Font("dialog.plain", 0, 12));
02402 ivjClearValuesButton.setMargin(new java.awt.Insets(2, 14, 2, 14));
02403
02404
02405 } catch (java.lang.Throwable ivjExc) {
02406
02407
02408 handleException(ivjExc);
02409 }
02410 }
02411 return ivjClearValuesButton;
02412 }
02413
02414
02415
02416
02417
02418 public CodeBrowserPane getCodeBrowserPane() {
02419 if (ivjCodeBrowserPane == null) {
02420 try {
02421 ivjCodeBrowserPane = new edu.ksu.cis.bandera.pdgslicer.dependency.CodeBrowserPane();
02422 ivjCodeBrowserPane.setName("CodeBrowserPane");
02423
02424 ivjCodeBrowserPane.setDependFrame(this);
02425
02426 } catch (java.lang.Throwable ivjExc) {
02427
02428
02429 handleException(ivjExc);
02430 }
02431 }
02432 return ivjCodeBrowserPane;
02433 }
02434
02435
02436
02437
02438
02439 public javax.swing.JSplitPane getCodeCritSplitPane() {
02440 if (ivjCodeCritSplitPane == null) {
02441 try {
02442 ivjCodeCritSplitPane = new javax.swing.JSplitPane(javax.swing.JSplitPane.VERTICAL_SPLIT);
02443 ivjCodeCritSplitPane.setName("CodeCritSplitPane");
02444 ivjCodeCritSplitPane.setDividerLocation(151);
02445 getCodeCritSplitPane().add(getCodeBrowserPane(), "top");
02446 getCodeCritSplitPane().add(getViewerTabbedPane(), "bottom");
02447
02448 getCodeCritSplitPane().setDividerLocation(200);
02449
02450
02451 } catch (java.lang.Throwable ivjExc) {
02452
02453
02454 handleException(ivjExc);
02455 }
02456 }
02457 return ivjCodeCritSplitPane;
02458 }
02459 private Set getControlDependAnnotationsFor(Annotation mda, Annotation stmtAnnotation, boolean isPred) {
02460 Set dependAnnotations = new ArraySet();
02461 if (stmtAnnotation instanceof MethodDeclarationAnnotation)
02462 return dependAnnotations;
02463 if (stmtAnnotation instanceof ConstructorDeclarationAnnotation)
02464 return dependAnnotations;
02465 SootMethod sootMethod = null;
02466 if (mda instanceof MethodDeclarationAnnotation)
02467 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
02468 else
02469 if (mda instanceof ConstructorDeclarationAnnotation)
02470 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
02471 Map sootMap = Slicer.sootMethodInfoMap;
02472 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
02473 StmtList stmtList = methodInfo.originalStmtList;
02474 BuildPDG methodPDG = methodInfo.methodPDG;
02475 Stmt[] stmtsInAnnotation;
02476
02477
02478
02479
02480
02481
02482
02483
02484 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
02485 stmtsInAnnotation = new Stmt[1];
02486 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
02487 } else
02488 if (stmtAnnotation instanceof ConditionalAnnotation) {
02489 stmtsInAnnotation = new Stmt[1];
02490 Stmt[] testStmts = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
02491 stmtsInAnnotation[0] = testStmts[0];
02492 } else
02493 if (stmtAnnotation instanceof ControlFlowAnnotation) {
02494 stmtsInAnnotation = new Stmt[1];
02495 Stmt[] testStmts = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
02496 stmtsInAnnotation[0] = testStmts[0];
02497 } else
02498 stmtsInAnnotation = stmtAnnotation.getStatements();
02499 if (isPred)
02500 for (int i = 0; i < stmtsInAnnotation.length; i++) {
02501 BitSet cdSet = methodPDG.controlNodesOf(stmtsInAnnotation[i]);
02502 if (cdSet == null)
02503 continue;
02504 for (int j = 0; j < stmtList.size(); j++) {
02505 if (cdSet.get(j)) {
02506 Stmt cdStmt = (Stmt) stmtList.get(j);
02507 Annotation cdStmtAnnotation = null;
02508 try {
02509 cdStmtAnnotation = mda.getContainingAnnotation(cdStmt);
02510 } catch (AnnotationException ae) {
02511 System.out.println("there is an AnnotationException! And cdStmtAnnotation may be null");
02512 }
02513 if (!cdStmtAnnotation.equals(stmtAnnotation)) {
02514 if (!cdStmtAnnotation.toString().equals(""))
02515 dependAnnotations.add(cdStmtAnnotation);
02516 }
02517 }
02518 }
02519 } else
02520 for (int i = 0; i < stmtsInAnnotation.length; i++) {
02521 Set cdSet = methodPDG.controlSuccNodesOf(stmtsInAnnotation[i]);
02522 if (cdSet == null)
02523 continue;
02524 for (Iterator j = cdSet.iterator(); j.hasNext();) {
02525 Stmt cdStmt = (Stmt) j.next();
02526 Annotation cdStmtAnnotation = null;
02527 try {
02528 cdStmtAnnotation = mda.getContainingAnnotation(cdStmt);
02529 } catch (AnnotationException ae) {
02530 System.out.println("there is an AnnotationException! And cdStmtAnnotation may be null");
02531 }
02532 if (!cdStmtAnnotation.equals(stmtAnnotation)) {
02533 if (!cdStmtAnnotation.toString().equals(""))
02534 dependAnnotations.add(cdStmtAnnotation);
02535 }
02536 }
02537 }
02538 if (dependAnnotations.size() == 0)
02539 dependAnnotations.add(mda);
02540 return dependAnnotations;
02541 }
02542 private DefaultMutableTreeNode getControlDependAnns(boolean isPred) {
02543 DefaultMutableTreeNode controlRoot = null;
02544 if (isPred)
02545 controlRoot = new DefaultMutableTreeNode("Predecessors");
02546 else
02547 controlRoot = new DefaultMutableTreeNode("Successors");
02548 Set controlAnnotationsForOneNode;
02549 Annotation mda;
02550 if (currentNode instanceof StmtTreeNode) {
02551 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
02552 mda = startTreeNode.currentMethodDeclarationAnnotation;
02553 currentMethodDecAnn = mda;
02554 controlAnnotationsForOneNode = getControlDependAnnotationsFor(mda, startTreeNode.currentStmtAnnotation, isPred);
02555 } else
02556 if (currentNode instanceof Annotation) {
02557 mda = currentMethodDecAnn;
02558 controlAnnotationsForOneNode = getControlDependAnnotationsFor(mda, (Annotation) currentNode, isPred);
02559 } else
02560 return controlRoot;
02561 if (controlAnnotationsForOneNode.isEmpty())
02562 return controlRoot;
02563 Hashtable controlAnnotationsForCurrentLevel = new Hashtable();
02564 controlAnnotationsForCurrentLevel.put(controlRoot, controlAnnotationsForOneNode);
02565 Hashtable controlAnnotationsForNextLevel;
02566 do {
02567 controlAnnotationsForNextLevel = new Hashtable();
02568 for (java.util.Iterator controlIt = controlAnnotationsForCurrentLevel.keySet().iterator(); controlIt.hasNext();) {
02569 DefaultMutableTreeNode currentRootNode = (DefaultMutableTreeNode) controlIt.next();
02570 Set cdAnnotations = (Set) controlAnnotationsForCurrentLevel.get(currentRootNode);
02571
02572 for (Iterator cdIt = cdAnnotations.iterator(); cdIt.hasNext();) {
02573 Annotation cdAnn = (Annotation) cdIt.next();
02574 DefaultMutableTreeNode cdNode = new DefaultMutableTreeNode(cdAnn);
02575 currentRootNode.add(cdNode);
02576 controlAnnotationsForOneNode = getControlDependAnnotationsFor(mda, cdAnn, isPred);
02577 if (!controlAnnotationsForOneNode.isEmpty())
02578 controlAnnotationsForNextLevel.put(cdNode, controlAnnotationsForOneNode);
02579 }
02580 }
02581 controlAnnotationsForCurrentLevel = controlAnnotationsForNextLevel;
02582 } while (!controlAnnotationsForNextLevel.isEmpty());
02583 return controlRoot;
02584 }
02585
02586
02587
02588
02589
02590 private javax.swing.JLabel getControlLabel() {
02591 if (ivjControlLabel == null) {
02592 try {
02593 ivjControlLabel = new javax.swing.JLabel();
02594 ivjControlLabel.setName("ControlLabel");
02595 ivjControlLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/control.jpg")));
02596 ivjControlLabel.setText("");
02597 ivjControlLabel.setBackground(new java.awt.Color(204,204,255));
02598 ivjControlLabel.setForeground(java.awt.Color.black);
02599
02600
02601 } catch (java.lang.Throwable ivjExc) {
02602
02603
02604 handleException(ivjExc);
02605 }
02606 }
02607 return ivjControlLabel;
02608 }
02609
02610
02611
02612
02613
02614 private javax.swing.JCheckBox getControlPredCheckBox() {
02615 if (ivjControlPredCheckBox == null) {
02616 try {
02617 ivjControlPredCheckBox = new javax.swing.JCheckBox();
02618 ivjControlPredCheckBox.setName("ControlPredCheckBox");
02619 ivjControlPredCheckBox.setText("");
02620 ivjControlPredCheckBox.setBackground(new java.awt.Color(204,204,255));
02621
02622
02623 } catch (java.lang.Throwable ivjExc) {
02624
02625
02626 handleException(ivjExc);
02627 }
02628 }
02629 return ivjControlPredCheckBox;
02630 }
02631
02632
02633
02634
02635
02636 private javax.swing.JCheckBox getControlSuccCheckBox() {
02637 if (ivjControlSuccCheckBox == null) {
02638 try {
02639 ivjControlSuccCheckBox = new javax.swing.JCheckBox();
02640 ivjControlSuccCheckBox.setName("ControlSuccCheckBox");
02641 ivjControlSuccCheckBox.setText("");
02642 ivjControlSuccCheckBox.setBackground(new java.awt.Color(204,204,255));
02643
02644
02645 } catch (java.lang.Throwable ivjExc) {
02646
02647
02648 handleException(ivjExc);
02649 }
02650 }
02651 return ivjControlSuccCheckBox;
02652 }
02653 private Configuration getCurrentConfig() {
02654 Configuration currentConfig = new Configuration();
02655 currentConfig.viewerState = getViewerTabbedPane().getSelectedIndex();
02656 currentConfig.queryIndex = queryPanel.getQueryKindComboBox().getSelectedIndex();
02657 currentConfig.dependValueViewerState = dependencyValueViewer.getViewersCurrentState();
02658 currentConfig.currentValueTreeRoot = dependencyValueViewer.currentValueTreeRoot;
02659 currentConfig.currentDependTreeRoot = dependencyValueViewer.currentDependTreeRoot;
02660 currentConfig.dataPred = doPredDataDepend;
02661 currentConfig.dataSucc = doSuccDataDepend;
02662 currentConfig.controlPred = doPredControlDepend;
02663 currentConfig.controlSucc = doSuccControlDepend;
02664 currentConfig.divergentPred = doPredDivergentDepend;
02665 currentConfig.divergentSucc = doSuccDivergentDepend;
02666 currentConfig.readyPred = doPredReadyDepend;
02667 currentConfig.readySucc = doSuccReadyDepend;
02668 currentConfig.synchPred = doPredSynchDepend;
02669 currentConfig.synchSucc = doSuccSynchDepend;
02670 currentConfig.interferPred = doPredInterferDepend;
02671 currentConfig.interferSucc = doSuccInterferDepend;
02672 currentConfig.valuePred = doPredValue;
02673 currentConfig.valueSucc = doSuccValue;
02674 currentConfig.valueSet = doSetValue;
02675 return currentConfig;
02676 }
02677
02678
02679
02680
02681
02682 private javax.swing.JLabel getCurrentStmtLabel() {
02683 if (ivjCurrentStmtLabel == null) {
02684 try {
02685 ivjCurrentStmtLabel = new javax.swing.JLabel();
02686 ivjCurrentStmtLabel.setName("CurrentStmtLabel");
02687 ivjCurrentStmtLabel.setText("Current Stmt : ");
02688 ivjCurrentStmtLabel.setForeground(java.awt.Color.black);
02689 ivjCurrentStmtLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
02690
02691
02692 } catch (java.lang.Throwable ivjExc) {
02693
02694
02695 handleException(ivjExc);
02696 }
02697 }
02698 return ivjCurrentStmtLabel;
02699 }
02700 private Set getDataDependAnnotationsFor(Annotation mda, Annotation stmtAnnotation, boolean isPred) {
02701 Set dependAnnotations = new ArraySet();
02702 SootMethod sootMethod = null;
02703 if (mda instanceof MethodDeclarationAnnotation)
02704 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
02705 else
02706 if (mda instanceof ConstructorDeclarationAnnotation)
02707 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
02708 Map sootMap = Slicer.sootMethodInfoMap;
02709 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
02710 BuildPDG methodPDG = methodInfo.methodPDG;
02711 Stmt stmtsInAnnotation[];
02712 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
02713 stmtsInAnnotation = new Stmt[1];
02714 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
02715 } else
02716 if (stmtAnnotation instanceof ConditionalAnnotation) {
02717 stmtsInAnnotation = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
02718 } else
02719 if (stmtAnnotation instanceof ControlFlowAnnotation) {
02720 stmtsInAnnotation = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
02721 } else
02722 stmtsInAnnotation = stmtAnnotation.getStatements();
02723 for (int i = 0; i < stmtsInAnnotation.length; i++) {
02724 Set ddSet = null;
02725 if (isPred)
02726 ddSet = methodPDG.dataNodesOf(stmtsInAnnotation[i]);
02727 else
02728 ddSet = methodPDG.dataSuccNodesOf(stmtsInAnnotation[i]);
02729 if (ddSet == null)
02730 continue;
02731 for (Iterator setIt = ddSet.iterator(); setIt.hasNext();) {
02732 Stmt ddStmt = null;
02733 if (isPred)
02734 ddStmt = ((DataBox) setIt.next()).getStmt();
02735 else
02736 ddStmt = (Stmt) setIt.next();
02737 if (ddStmt instanceof IdentityStmt) {
02738 ParameterNode paraNode = new ParameterNode(methodInfo.sootClass, mda, (IdentityStmt) ddStmt);
02739 dependAnnotations.add(paraNode);
02740 } else {
02741 Annotation ddStmtAnnotation = null;
02742 try {
02743 ddStmtAnnotation = mda.getContainingAnnotation(ddStmt);
02744 } catch (AnnotationException ae) {
02745 System.out.println("there is an AnnotationException! And ddStmtAnnotation may be null");
02746 }
02747 if (!ddStmtAnnotation.toString().equals(""))
02748 if (!ddStmtAnnotation.equals(stmtAnnotation))
02749 dependAnnotations.add(ddStmtAnnotation);
02750 }
02751 }
02752 }
02753 return dependAnnotations;
02754 }
02755 private DefaultMutableTreeNode getDataDependAnns(boolean isPred) {
02756 DefaultMutableTreeNode dataRoot = null;
02757 if (isPred)
02758 dataRoot = new DefaultMutableTreeNode("Predecessors");
02759 else
02760 dataRoot = new DefaultMutableTreeNode("Successors");
02761 Set dataAnnotationsForOneNode;
02762 Annotation mda;
02763 if (currentNode instanceof StmtTreeNode) {
02764 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
02765 mda = startTreeNode.currentMethodDeclarationAnnotation;
02766 currentMethodDecAnn = mda;
02767 dataAnnotationsForOneNode = getDataDependAnnotationsFor(mda, startTreeNode.currentStmtAnnotation, isPred);
02768 } else
02769 if (currentNode instanceof Annotation) {
02770 mda = currentMethodDecAnn;
02771 dataAnnotationsForOneNode = getDataDependAnnotationsFor(mda, (Annotation) currentNode, isPred);
02772 } else
02773 return dataRoot;
02774 if (dataAnnotationsForOneNode.isEmpty())
02775 return dataRoot;
02776 Hashtable dataAnnotationsForCurrentLevel = new Hashtable();
02777 dataAnnotationsForCurrentLevel.put(dataRoot, dataAnnotationsForOneNode);
02778 Hashtable dataAnnotationsForNextLevel;
02779 do {
02780 dataAnnotationsForNextLevel = new Hashtable();
02781 for (java.util.Iterator dataIt = dataAnnotationsForCurrentLevel.keySet().iterator(); dataIt.hasNext();) {
02782 DefaultMutableTreeNode currentRootNode = (DefaultMutableTreeNode) dataIt.next();
02783 Set ddAnnotations = (Set) dataAnnotationsForCurrentLevel.get(currentRootNode);
02784
02785 for (Iterator ddIt = ddAnnotations.iterator(); ddIt.hasNext();) {
02786 Object ddObject = ddIt.next();
02787 if (ddObject instanceof ParameterNode) {
02788 DefaultMutableTreeNode paraNode = new DefaultMutableTreeNode(ddObject);
02789 if (ddObject.toString().equals("JJJCTEMP$0"))
02790 paraNode = new DefaultMutableTreeNode("this");
02791 currentRootNode.add(paraNode);
02792 } else {
02793 Annotation ddAnn = (Annotation) ddObject;
02794 DefaultMutableTreeNode ddNode = new DefaultMutableTreeNode(ddAnn);
02795 currentRootNode.add(ddNode);
02796 if (treePathContains(currentRootNode, ddAnn))
02797 dataAnnotationsForOneNode = new ArraySet();
02798 else
02799 dataAnnotationsForOneNode = getDataDependAnnotationsFor(mda, ddAnn, isPred);
02800 if (!dataAnnotationsForOneNode.isEmpty())
02801 dataAnnotationsForNextLevel.put(ddNode, dataAnnotationsForOneNode);
02802 }
02803 }
02804 }
02805 dataAnnotationsForCurrentLevel = dataAnnotationsForNextLevel;
02806 }
02807 while (!dataAnnotationsForNextLevel.isEmpty());
02808 return dataRoot;
02809 }
02810
02811
02812
02813
02814
02815 private javax.swing.JLabel getDataLabel() {
02816 if (ivjDataLabel == null) {
02817 try {
02818 ivjDataLabel = new javax.swing.JLabel();
02819 ivjDataLabel.setName("DataLabel");
02820 ivjDataLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/data.jpg")));
02821 ivjDataLabel.setText("");
02822 ivjDataLabel.setBackground(new java.awt.Color(204,204,255));
02823 ivjDataLabel.setForeground(java.awt.Color.black);
02824
02825
02826 } catch (java.lang.Throwable ivjExc) {
02827
02828
02829 handleException(ivjExc);
02830 }
02831 }
02832 return ivjDataLabel;
02833 }
02834
02835
02836
02837
02838
02839 private javax.swing.JCheckBox getDataPredCheckBox() {
02840 if (ivjDataPredCheckBox == null) {
02841 try {
02842 ivjDataPredCheckBox = new javax.swing.JCheckBox();
02843 ivjDataPredCheckBox.setName("DataPredCheckBox");
02844 ivjDataPredCheckBox.setText("");
02845 ivjDataPredCheckBox.setBackground(new java.awt.Color(204,204,255));
02846
02847
02848 } catch (java.lang.Throwable ivjExc) {
02849
02850
02851 handleException(ivjExc);
02852 }
02853 }
02854 return ivjDataPredCheckBox;
02855 }
02856
02857
02858
02859
02860
02861 private javax.swing.JCheckBox getDataSuccCheckBox() {
02862 if (ivjDataSuccCheckBox == null) {
02863 try {
02864 ivjDataSuccCheckBox = new javax.swing.JCheckBox();
02865 ivjDataSuccCheckBox.setName("DataSuccCheckBox");
02866 ivjDataSuccCheckBox.setText("");
02867 ivjDataSuccCheckBox.setBackground(new java.awt.Color(204,204,255));
02868
02869
02870 } catch (java.lang.Throwable ivjExc) {
02871
02872
02873 handleException(ivjExc);
02874 }
02875 }
02876 return ivjDataSuccCheckBox;
02877 }
02878
02879
02880
02881
02882
02883 private javax.swing.JPanel getDependCheckBoxesPanel() {
02884 if (ivjDependCheckBoxesPanel == null) {
02885 try {
02886 ivjDependCheckBoxesPanel = new javax.swing.JPanel();
02887 ivjDependCheckBoxesPanel.setName("DependCheckBoxesPanel");
02888 ivjDependCheckBoxesPanel.setLayout(new java.awt.GridBagLayout());
02889 ivjDependCheckBoxesPanel.setBackground(new java.awt.Color(204,204,255));
02890
02891 java.awt.GridBagConstraints constraintsDataPredCheckBox = new java.awt.GridBagConstraints();
02892 constraintsDataPredCheckBox.gridx = 0; constraintsDataPredCheckBox.gridy = 1;
02893 constraintsDataPredCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02894 getDependCheckBoxesPanel().add(getDataPredCheckBox(), constraintsDataPredCheckBox);
02895
02896 java.awt.GridBagConstraints constraintsDataSuccCheckBox = new java.awt.GridBagConstraints();
02897 constraintsDataSuccCheckBox.gridx = 0; constraintsDataSuccCheckBox.gridy = 2;
02898 constraintsDataSuccCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02899 getDependCheckBoxesPanel().add(getDataSuccCheckBox(), constraintsDataSuccCheckBox);
02900
02901 java.awt.GridBagConstraints constraintsDataLabel = new java.awt.GridBagConstraints();
02902 constraintsDataLabel.gridx = 0; constraintsDataLabel.gridy = 0;
02903 constraintsDataLabel.insets = new java.awt.Insets(4, 4, 4, 4);
02904 getDependCheckBoxesPanel().add(getDataLabel(), constraintsDataLabel);
02905
02906 java.awt.GridBagConstraints constraintsControlPredCheckBox = new java.awt.GridBagConstraints();
02907 constraintsControlPredCheckBox.gridx = 1; constraintsControlPredCheckBox.gridy = 1;
02908 constraintsControlPredCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02909 getDependCheckBoxesPanel().add(getControlPredCheckBox(), constraintsControlPredCheckBox);
02910
02911 java.awt.GridBagConstraints constraintsControlLabel = new java.awt.GridBagConstraints();
02912 constraintsControlLabel.gridx = 1; constraintsControlLabel.gridy = 0;
02913 constraintsControlLabel.insets = new java.awt.Insets(4, 4, 4, 4);
02914 getDependCheckBoxesPanel().add(getControlLabel(), constraintsControlLabel);
02915
02916 java.awt.GridBagConstraints constraintsControlSuccCheckBox = new java.awt.GridBagConstraints();
02917 constraintsControlSuccCheckBox.gridx = 1; constraintsControlSuccCheckBox.gridy = 2;
02918 constraintsControlSuccCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02919 getDependCheckBoxesPanel().add(getControlSuccCheckBox(), constraintsControlSuccCheckBox);
02920
02921 java.awt.GridBagConstraints constraintsReadyLabel = new java.awt.GridBagConstraints();
02922 constraintsReadyLabel.gridx = 3; constraintsReadyLabel.gridy = 0;
02923 constraintsReadyLabel.insets = new java.awt.Insets(4, 4, 4, 4);
02924 getDependCheckBoxesPanel().add(getReadyLabel(), constraintsReadyLabel);
02925
02926 java.awt.GridBagConstraints constraintsReadyPredCheckBox = new java.awt.GridBagConstraints();
02927 constraintsReadyPredCheckBox.gridx = 3; constraintsReadyPredCheckBox.gridy = 1;
02928 constraintsReadyPredCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02929 getDependCheckBoxesPanel().add(getReadyPredCheckBox(), constraintsReadyPredCheckBox);
02930
02931 java.awt.GridBagConstraints constraintsReadySuccCheckBox = new java.awt.GridBagConstraints();
02932 constraintsReadySuccCheckBox.gridx = 3; constraintsReadySuccCheckBox.gridy = 2;
02933 constraintsReadySuccCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02934 getDependCheckBoxesPanel().add(getReadySuccCheckBox(), constraintsReadySuccCheckBox);
02935
02936 java.awt.GridBagConstraints constraintsInterferLabel = new java.awt.GridBagConstraints();
02937 constraintsInterferLabel.gridx = 4; constraintsInterferLabel.gridy = 0;
02938 constraintsInterferLabel.insets = new java.awt.Insets(4, 4, 4, 4);
02939 getDependCheckBoxesPanel().add(getInterferLabel(), constraintsInterferLabel);
02940
02941 java.awt.GridBagConstraints constraintsInterferPredCheckBox = new java.awt.GridBagConstraints();
02942 constraintsInterferPredCheckBox.gridx = 4; constraintsInterferPredCheckBox.gridy = 1;
02943 constraintsInterferPredCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02944 getDependCheckBoxesPanel().add(getInterferPredCheckBox(), constraintsInterferPredCheckBox);
02945
02946 java.awt.GridBagConstraints constraintsInterferSuccCheckBox = new java.awt.GridBagConstraints();
02947 constraintsInterferSuccCheckBox.gridx = 4; constraintsInterferSuccCheckBox.gridy = 2;
02948 constraintsInterferSuccCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02949 getDependCheckBoxesPanel().add(getInterferSuccCheckBox(), constraintsInterferSuccCheckBox);
02950
02951 java.awt.GridBagConstraints constraintsDiverLabel = new java.awt.GridBagConstraints();
02952 constraintsDiverLabel.gridx = 2; constraintsDiverLabel.gridy = 0;
02953 constraintsDiverLabel.insets = new java.awt.Insets(4, 4, 4, 4);
02954 getDependCheckBoxesPanel().add(getDiverLabel(), constraintsDiverLabel);
02955
02956 java.awt.GridBagConstraints constraintsDiverPredCheckBox = new java.awt.GridBagConstraints();
02957 constraintsDiverPredCheckBox.gridx = 2; constraintsDiverPredCheckBox.gridy = 1;
02958 constraintsDiverPredCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02959 getDependCheckBoxesPanel().add(getDiverPredCheckBox(), constraintsDiverPredCheckBox);
02960
02961 java.awt.GridBagConstraints constraintsDiverSuccCheckBox = new java.awt.GridBagConstraints();
02962 constraintsDiverSuccCheckBox.gridx = 2; constraintsDiverSuccCheckBox.gridy = 2;
02963 constraintsDiverSuccCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
02964 getDependCheckBoxesPanel().add(getDiverSuccCheckBox(), constraintsDiverSuccCheckBox);
02965
02966 java.awt.GridBagConstraints constraintsAllpredButton = new java.awt.GridBagConstraints();
02967 constraintsAllpredButton.gridx = 6; constraintsAllpredButton.gridy = 1;
02968 constraintsAllpredButton.insets = new java.awt.Insets(4, 4, 4, 4);
02969 getDependCheckBoxesPanel().add(getAllpredButton(), constraintsAllpredButton);
02970
02971 java.awt.GridBagConstraints constraintsAllsuccButton = new java.awt.GridBagConstraints();
02972 constraintsAllsuccButton.gridx = 6; constraintsAllsuccButton.gridy = 2;
02973 constraintsAllsuccButton.insets = new java.awt.Insets(4, 4, 4, 4);
02974 getDependCheckBoxesPanel().add(getAllsuccButton(), constraintsAllsuccButton);
02975
02976 java.awt.GridBagConstraints constraintsClearDependButton = new java.awt.GridBagConstraints();
02977 constraintsClearDependButton.gridx = 7; constraintsClearDependButton.gridy = 0;
02978 constraintsClearDependButton.insets = new java.awt.Insets(4, 4, 4, 4);
02979 getDependCheckBoxesPanel().add(getClearDependButton(), constraintsClearDependButton);
02980
02981 java.awt.GridBagConstraints constraintsNopredButton = new java.awt.GridBagConstraints();
02982 constraintsNopredButton.gridx = 7; constraintsNopredButton.gridy = 1;
02983 constraintsNopredButton.insets = new java.awt.Insets(4, 4, 4, 4);
02984 getDependCheckBoxesPanel().add(getNopredButton(), constraintsNopredButton);
02985
02986 java.awt.GridBagConstraints constraintsNosuccButton = new java.awt.GridBagConstraints();
02987 constraintsNosuccButton.gridx = 7; constraintsNosuccButton.gridy = 2;
02988 constraintsNosuccButton.anchor = java.awt.GridBagConstraints.WEST;
02989 constraintsNosuccButton.insets = new java.awt.Insets(4, 4, 4, 4);
02990 getDependCheckBoxesPanel().add(getNosuccButton(), constraintsNosuccButton);
02991
02992 java.awt.GridBagConstraints constraintsEmptyPanel = new java.awt.GridBagConstraints();
02993 constraintsEmptyPanel.gridx = 8; constraintsEmptyPanel.gridy = 0;
02994 constraintsEmptyPanel.fill = java.awt.GridBagConstraints.BOTH;
02995 constraintsEmptyPanel.weightx = 1.0;
02996 constraintsEmptyPanel.weighty = 1.0;
02997 constraintsEmptyPanel.insets = new java.awt.Insets(4, 4, 4, 4);
02998 getDependCheckBoxesPanel().add(getEmptyPanel(), constraintsEmptyPanel);
02999
03000 java.awt.GridBagConstraints constraintsAllDependButton = new java.awt.GridBagConstraints();
03001 constraintsAllDependButton.gridx = 6; constraintsAllDependButton.gridy = 0;
03002 constraintsAllDependButton.insets = new java.awt.Insets(4, 4, 4, 4);
03003 getDependCheckBoxesPanel().add(getAllDependButton(), constraintsAllDependButton);
03004
03005 java.awt.GridBagConstraints constraintsSynchLabel = new java.awt.GridBagConstraints();
03006 constraintsSynchLabel.gridx = 5; constraintsSynchLabel.gridy = 0;
03007 constraintsSynchLabel.insets = new java.awt.Insets(4, 4, 4, 4);
03008 getDependCheckBoxesPanel().add(getSynchLabel(), constraintsSynchLabel);
03009
03010 java.awt.GridBagConstraints constraintsSynchPredCheckBox = new java.awt.GridBagConstraints();
03011 constraintsSynchPredCheckBox.gridx = 5; constraintsSynchPredCheckBox.gridy = 1;
03012 constraintsSynchPredCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
03013 getDependCheckBoxesPanel().add(getSynchPredCheckBox(), constraintsSynchPredCheckBox);
03014
03015 java.awt.GridBagConstraints constraintsSynchSuccCheckBox = new java.awt.GridBagConstraints();
03016 constraintsSynchSuccCheckBox.gridx = 5; constraintsSynchSuccCheckBox.gridy = 2;
03017 constraintsSynchSuccCheckBox.insets = new java.awt.Insets(4, 4, 4, 4);
03018 getDependCheckBoxesPanel().add(getSynchSuccCheckBox(), constraintsSynchSuccCheckBox);
03019
03020
03021 } catch (java.lang.Throwable ivjExc) {
03022
03023
03024 handleException(ivjExc);
03025 }
03026 }
03027 return ivjDependCheckBoxesPanel;
03028 }
03029
03030
03031
03032
03033
03034 private javax.swing.JPanel getDependencyFrameContentPane() {
03035 if (ivjDependencyFrameContentPane == null) {
03036 try {
03037 ivjDependencyFrameContentPane = new javax.swing.JPanel();
03038 ivjDependencyFrameContentPane.setName("DependencyFrameContentPane");
03039 ivjDependencyFrameContentPane.setBorder(new javax.swing.border.EtchedBorder());
03040 ivjDependencyFrameContentPane.setLayout(new java.awt.BorderLayout());
03041 getDependencyFrameContentPane().add(getOperationPanel(), "North");
03042 getDependencyFrameContentPane().add(getCodeCritSplitPane(), "Center");
03043
03044
03045
03046 } catch (java.lang.Throwable ivjExc) {
03047
03048
03049 handleException(ivjExc);
03050 }
03051 }
03052 return ivjDependencyFrameContentPane;
03053 }
03054
03055
03056
03057
03058
03059
03060
03061 private DefaultMutableTreeNode getDependencyTreeNode(String dependKind, boolean isPred) {
03062 int kind = dependencyKindsList.indexOf(dependKind);
03063 DefaultMutableTreeNode returnNode = null;
03064 switch (kind) {
03065 case DATA :
03066 returnNode = getDataDependAnns(isPred);
03067 break;
03068 case CONTROL :
03069 returnNode = getControlDependAnns(isPred);
03070 break;
03071 case DIVERGENT :
03072 returnNode = getDivergentDependAnns(isPred);
03073 break;
03074 case READY :
03075 returnNode = getReadyDependAnns(isPred);
03076 break;
03077 case INTERFERENCE :
03078 returnNode = getInterferDependAnns(isPred);
03079 break;
03080 case SYNCHRONIZATION :
03081 returnNode = getSynchDependAnns(isPred);
03082 break;
03083 }
03084 return returnNode;
03085 }
03086
03087
03088
03089
03090
03091 DependencyValueViewer getDependencyValueViewer() {
03092 return dependencyValueViewer;
03093 }
03094
03095
03096
03097
03098
03099 private javax.swing.JLabel getDependLabel() {
03100 if (ivjDependLabel == null) {
03101 try {
03102 ivjDependLabel = new javax.swing.JLabel();
03103 ivjDependLabel.setName("DependLabel");
03104 ivjDependLabel.setText("Dependencies : ");
03105 ivjDependLabel.setForeground(java.awt.Color.black);
03106 ivjDependLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
03107
03108
03109 } catch (java.lang.Throwable ivjExc) {
03110
03111
03112 handleException(ivjExc);
03113 }
03114 }
03115 return ivjDependLabel;
03116 }
03117
03118
03119
03120
03121
03122 private javax.swing.JToolBar getDependOperationToolBar() {
03123 if (ivjDependOperationToolBar == null) {
03124 try {
03125 ivjDependOperationToolBar = new javax.swing.JToolBar();
03126 ivjDependOperationToolBar.setName("DependOperationToolBar");
03127 ivjDependOperationToolBar.setPreferredSize(new java.awt.Dimension(259, 50));
03128 ivjDependOperationToolBar.setBackground(new java.awt.Color(204,204,255));
03129 ivjDependOperationToolBar.setMinimumSize(new java.awt.Dimension(224, 50));
03130 getDependOperationToolBar().add(getToolBarInPanel(), getToolBarInPanel().getName());
03131
03132
03133 } catch (java.lang.Throwable ivjExc) {
03134
03135
03136 handleException(ivjExc);
03137 }
03138 }
03139 return ivjDependOperationToolBar;
03140 }
03141 private Set getDivergentDependAnnotationsFor(Annotation mda, Annotation stmtAnnotation, boolean isPred) {
03142 Set dependAnnotations = new ArraySet();
03143 if (stmtAnnotation instanceof MethodDeclarationAnnotation)
03144 return dependAnnotations;
03145 if (stmtAnnotation instanceof ConstructorDeclarationAnnotation)
03146 return dependAnnotations;
03147 SootMethod sootMethod = null;
03148 if (mda instanceof MethodDeclarationAnnotation)
03149 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
03150 else
03151 if (mda instanceof ConstructorDeclarationAnnotation)
03152 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
03153 Map sootMap = Slicer.sootMethodInfoMap;
03154 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
03155 StmtList stmtList = methodInfo.originalStmtList;
03156 BuildPDG methodPDG = methodInfo.methodPDG;
03157 Stmt[] stmtsInAnnotation;
03158
03159
03160
03161
03162
03163
03164
03165
03166 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
03167 stmtsInAnnotation = new Stmt[1];
03168 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
03169 } else
03170 if (stmtAnnotation instanceof ConditionalAnnotation) {
03171 stmtsInAnnotation = new Stmt[1];
03172 Stmt[] testStmts = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
03173 stmtsInAnnotation[0] = testStmts[0];
03174 } else
03175 if (stmtAnnotation instanceof ControlFlowAnnotation) {
03176 stmtsInAnnotation = new Stmt[1];
03177 Stmt[] testStmts = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
03178 stmtsInAnnotation[0] = testStmts[0];
03179 } else
03180 stmtsInAnnotation = stmtAnnotation.getStatements();
03181 if (isPred)
03182 for (int i = 0; i < stmtsInAnnotation.length; i++) {
03183 BitSet diverSet = methodPDG.preDivergencePointsOf(stmtsInAnnotation[i]);
03184 if (diverSet == null)
03185 continue;
03186 for (int j = 0; j < stmtList.size(); j++) {
03187 if (diverSet.get(j)) {
03188 Stmt diverStmt = (Stmt) stmtList.get(j);
03189 Annotation diverStmtAnnotation = null;
03190 try {
03191 diverStmtAnnotation = mda.getContainingAnnotation(diverStmt);
03192 } catch (AnnotationException ae) {
03193 System.out.println("there is an AnnotationException! And cdStmtAnnotation may be null");
03194 }
03195 if (!diverStmtAnnotation.equals(stmtAnnotation)) {
03196 if (!diverStmtAnnotation.toString().equals(""))
03197 dependAnnotations.add(diverStmtAnnotation);
03198 }
03199 }
03200 }
03201 } else
03202 for (int i = 0; i < stmtsInAnnotation.length; i++) {
03203 BitSet diverSet = methodPDG.succDivergencePointsOf(stmtsInAnnotation[i]);
03204 if (diverSet == null)
03205 continue;
03206 for (int j = 0; j < stmtList.size(); j++) {
03207 if (diverSet.get(j)) {
03208 Stmt diverStmt = (Stmt) stmtList.get(j);
03209 Annotation diverStmtAnnotation = null;
03210 try {
03211 diverStmtAnnotation = mda.getContainingAnnotation(diverStmt);
03212 } catch (AnnotationException ae) {
03213 System.out.println("there is an AnnotationException! And cdStmtAnnotation may be null");
03214 }
03215 if (!diverStmtAnnotation.equals(stmtAnnotation)) {
03216 if (!diverStmtAnnotation.toString().equals(""))
03217 dependAnnotations.add(diverStmtAnnotation);
03218 }
03219 }
03220 }
03221 }
03222 if (dependAnnotations.size() == 0)
03223 dependAnnotations.add(mda);
03224 return dependAnnotations;
03225 }
03226 private DefaultMutableTreeNode getDivergentDependAnns(boolean isPred) {
03227 DefaultMutableTreeNode divergenceRoot = null;
03228 if (isPred)
03229 divergenceRoot = new DefaultMutableTreeNode("Predecessors");
03230 else
03231 divergenceRoot = new DefaultMutableTreeNode("Successors");
03232 Set divergenceAnnotationsForOneNode;
03233 Annotation mda;
03234 if (currentNode instanceof StmtTreeNode) {
03235 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
03236 mda = startTreeNode.currentMethodDeclarationAnnotation;
03237 currentMethodDecAnn = mda;
03238 divergenceAnnotationsForOneNode = getDivergentDependAnnotationsFor(mda, startTreeNode.currentStmtAnnotation, isPred);
03239 } else
03240 if (currentNode instanceof Annotation) {
03241 mda = currentMethodDecAnn;
03242 divergenceAnnotationsForOneNode = getDivergentDependAnnotationsFor(mda, (Annotation) currentNode, isPred);
03243 } else
03244 return divergenceRoot;
03245 if (divergenceAnnotationsForOneNode.isEmpty())
03246 return divergenceRoot;
03247 Hashtable divergenceAnnotationsForCurrentLevel = new Hashtable();
03248 divergenceAnnotationsForCurrentLevel.put(divergenceRoot, divergenceAnnotationsForOneNode);
03249 Hashtable divergenceAnnotationsForNextLevel;
03250 do {
03251 divergenceAnnotationsForNextLevel = new Hashtable();
03252 for (java.util.Iterator divergenceIt = divergenceAnnotationsForCurrentLevel.keySet().iterator(); divergenceIt.hasNext();) {
03253 DefaultMutableTreeNode currentRootNode = (DefaultMutableTreeNode) divergenceIt.next();
03254 Set divergenceAnnotations = (Set) divergenceAnnotationsForCurrentLevel.get(currentRootNode);
03255
03256 for (Iterator diverIt = divergenceAnnotations.iterator(); diverIt.hasNext();) {
03257 Annotation diverAnn = (Annotation) diverIt.next();
03258 DefaultMutableTreeNode diverNode = new DefaultMutableTreeNode(diverAnn);
03259 currentRootNode.add(diverNode);
03260 divergenceAnnotationsForOneNode = getDivergentDependAnnotationsFor(mda, diverAnn, isPred);
03261 if (!divergenceAnnotationsForOneNode.isEmpty())
03262 divergenceAnnotationsForNextLevel.put(diverNode, divergenceAnnotationsForOneNode);
03263 }
03264 }
03265 divergenceAnnotationsForCurrentLevel = divergenceAnnotationsForNextLevel;
03266 } while (!divergenceAnnotationsForNextLevel.isEmpty());
03267 return divergenceRoot;
03268 }
03269
03270
03271
03272
03273
03274 private javax.swing.JLabel getDiverLabel() {
03275 if (ivjDiverLabel == null) {
03276 try {
03277 ivjDiverLabel = new javax.swing.JLabel();
03278 ivjDiverLabel.setName("DiverLabel");
03279 ivjDiverLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/divergt.jpg")));
03280 ivjDiverLabel.setText("");
03281 ivjDiverLabel.setBackground(new java.awt.Color(204,204,255));
03282 ivjDiverLabel.setForeground(java.awt.Color.black);
03283
03284
03285 } catch (java.lang.Throwable ivjExc) {
03286
03287
03288 handleException(ivjExc);
03289 }
03290 }
03291 return ivjDiverLabel;
03292 }
03293
03294
03295
03296
03297
03298 private javax.swing.JCheckBox getDiverPredCheckBox() {
03299 if (ivjDiverPredCheckBox == null) {
03300 try {
03301 ivjDiverPredCheckBox = new javax.swing.JCheckBox();
03302 ivjDiverPredCheckBox.setName("DiverPredCheckBox");
03303 ivjDiverPredCheckBox.setText("");
03304 ivjDiverPredCheckBox.setBackground(new java.awt.Color(204,204,255));
03305
03306
03307 } catch (java.lang.Throwable ivjExc) {
03308
03309
03310 handleException(ivjExc);
03311 }
03312 }
03313 return ivjDiverPredCheckBox;
03314 }
03315
03316
03317
03318
03319
03320 private javax.swing.JCheckBox getDiverSuccCheckBox() {
03321 if (ivjDiverSuccCheckBox == null) {
03322 try {
03323 ivjDiverSuccCheckBox = new javax.swing.JCheckBox();
03324 ivjDiverSuccCheckBox.setName("DiverSuccCheckBox");
03325 ivjDiverSuccCheckBox.setText("");
03326 ivjDiverSuccCheckBox.setBackground(new java.awt.Color(204,204,255));
03327
03328
03329 } catch (java.lang.Throwable ivjExc) {
03330
03331
03332 handleException(ivjExc);
03333 }
03334 }
03335 return ivjDiverSuccCheckBox;
03336 }
03337
03338
03339
03340
03341
03342 private javax.swing.JLabel getDpredLabel() {
03343 if (ivjDpredLabel == null) {
03344 try {
03345 ivjDpredLabel = new javax.swing.JLabel();
03346 ivjDpredLabel.setName("DpredLabel");
03347 ivjDpredLabel.setFont(new java.awt.Font("dialog.plain", 0, 12));
03348 ivjDpredLabel.setText("pred");
03349 ivjDpredLabel.setForeground(java.awt.Color.black);
03350 ivjDpredLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
03351
03352
03353 } catch (java.lang.Throwable ivjExc) {
03354
03355
03356 handleException(ivjExc);
03357 }
03358 }
03359 return ivjDpredLabel;
03360 }
03361
03362
03363
03364
03365
03366 private javax.swing.JLabel getDsuccLabel() {
03367 if (ivjDsuccLabel == null) {
03368 try {
03369 ivjDsuccLabel = new javax.swing.JLabel();
03370 ivjDsuccLabel.setName("DsuccLabel");
03371 ivjDsuccLabel.setText("succ");
03372 ivjDsuccLabel.setForeground(java.awt.Color.black);
03373 ivjDsuccLabel.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
03374 ivjDsuccLabel.setFont(new java.awt.Font("dialog.plain", 0, 12));
03375 ivjDsuccLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
03376
03377
03378 } catch (java.lang.Throwable ivjExc) {
03379
03380
03381 handleException(ivjExc);
03382 }
03383 }
03384 return ivjDsuccLabel;
03385 }
03386
03387
03388
03389
03390
03391 private javax.swing.JPanel getEmptyPanel() {
03392 if (ivjEmptyPanel == null) {
03393 try {
03394 ivjEmptyPanel = new javax.swing.JPanel();
03395 ivjEmptyPanel.setName("EmptyPanel");
03396 ivjEmptyPanel.setLayout(null);
03397 ivjEmptyPanel.setBackground(new java.awt.Color(204,204,255));
03398
03399
03400 } catch (java.lang.Throwable ivjExc) {
03401
03402
03403 handleException(ivjExc);
03404 }
03405 }
03406 return ivjEmptyPanel;
03407 }
03408
03409
03410
03411
03412
03413
03414 private Hashtable getExitMonitorAnnotations(Annotation mda, List monitorPairList) {
03415 Hashtable anns = new Hashtable();
03416 for (Iterator monitorIt = monitorPairList.iterator(); monitorIt.hasNext();) {
03417 MonitorPair mp = (MonitorPair) monitorIt.next();
03418 Annotation bodyAnnotation = mp.getSynchroBodyAnn();
03419 Vector bodyAnns = bodyAnnotation.getAllAnnotations(true);
03420 int indexOfLast = bodyAnns.lastIndexOf(bodyAnns.lastElement());
03421 Annotation exitMonitorAnn = (Annotation) bodyAnns.get(indexOfLast - 1);
03422
03423 if (exitMonitorAnn != null)
03424 anns.put(exitMonitorAnn, mp);
03425 }
03426 return anns;
03427 }
03428
03429
03430
03431
03432
03433 private javax.swing.JButton getForwardSliceToolBarButton() {
03434 if (ivjForwardSliceToolBarButton == null) {
03435 try {
03436 ivjForwardSliceToolBarButton = new javax.swing.JButton();
03437 ivjForwardSliceToolBarButton.setName("ForwardSliceToolBarButton");
03438 ivjForwardSliceToolBarButton.setBorder(new javax.swing.border.CompoundBorder());
03439 ivjForwardSliceToolBarButton.setText("F-Slice");
03440 ivjForwardSliceToolBarButton.setBackground(new java.awt.Color(204,204,255));
03441 ivjForwardSliceToolBarButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
03442 ivjForwardSliceToolBarButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
03443 ivjForwardSliceToolBarButton.setIcon(null);
03444 ivjForwardSliceToolBarButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
03445 ivjForwardSliceToolBarButton.setEnabled(false);
03446
03447
03448 } catch (java.lang.Throwable ivjExc) {
03449
03450
03451 handleException(ivjExc);
03452 }
03453 }
03454 return ivjForwardSliceToolBarButton;
03455 }
03456
03457
03458
03459
03460
03461 private javax.swing.JButton getForwardToolBarButton() {
03462 if (ivjForwardToolBarButton == null) {
03463 try {
03464 ivjForwardToolBarButton = new javax.swing.JButton();
03465 ivjForwardToolBarButton.setName("ForwardToolBarButton");
03466 ivjForwardToolBarButton.setBorder(new javax.swing.border.CompoundBorder());
03467 ivjForwardToolBarButton.setText("forward");
03468 ivjForwardToolBarButton.setBackground(new java.awt.Color(204,204,255));
03469 ivjForwardToolBarButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
03470 ivjForwardToolBarButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
03471 ivjForwardToolBarButton.setIcon(null);
03472 ivjForwardToolBarButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
03473 ivjForwardToolBarButton.setEnabled(false);
03474
03475
03476 } catch (java.lang.Throwable ivjExc) {
03477
03478
03479 handleException(ivjExc);
03480 }
03481 }
03482 return ivjForwardToolBarButton;
03483 }
03484
03485
03486
03487
03488
03489 public javax.swing.JComboBox getHistoryComboBox() {
03490 if (ivjHistoryComboBox == null) {
03491 try {
03492 ivjHistoryComboBox = new javax.swing.JComboBox();
03493 ivjHistoryComboBox.setName("HistoryComboBox");
03494 ivjHistoryComboBox.setBackground(java.awt.Color.white);
03495
03496
03497 } catch (java.lang.Throwable ivjExc) {
03498
03499
03500 handleException(ivjExc);
03501 }
03502 }
03503 return ivjHistoryComboBox;
03504 }
03505 private Set getInterClassEnterMonitors(SootMethod currentMd, Set exitMonitors) {
03506 Set enterStmtTreeNodeSet = new ArraySet();
03507 for (Iterator sootIt = Slicer.sootMethodInfoMap.keySet().iterator(); sootIt.hasNext();) {
03508 SootMethod sootMethod = (SootMethod) sootIt.next();
03509 if (sootMethod.equals(currentMd))
03510 continue;
03511 MethodInfo methodInfo = (MethodInfo) Slicer.sootMethodInfoMap.get(sootMethod);
03512 Set enterStmtSet = enterSetEffectedBy(methodInfo, exitMonitors);
03513 Annotation mda = null;
03514 if (!enterStmtSet.isEmpty()) {
03515 try {
03516 mda = (Annotation) CompilationManager.getAnnotationManager().getAnnotation(methodInfo.sootClass, methodInfo.sootMethod);
03517 } catch (Exception ex) {
03518 System.out.println("There is an exception in geting Annotation");
03519 }
03520 }
03521 for (Iterator enterIt = enterStmtSet.iterator(); enterIt.hasNext();) {
03522 Stmt enterStmt = (Stmt) enterIt.next();
03523 Annotation enterAnn = null;
03524 try {
03525 enterAnn = mda.getContainingAnnotation(enterStmt);
03526 } catch (AnnotationException ae) {
03527 System.out.println("there is an AnnotationException! And enterMonitorStmtAnnotation may be null");
03528 }
03529 if (enterAnn != null)
03530 enterStmtTreeNodeSet.add(new StmtTreeNode(methodInfo.sootClass, mda, enterAnn));
03531 }
03532 }
03533 return enterStmtTreeNodeSet;
03534 }
03535
03536
03537
03538
03539
03540
03541
03542 private Set getInterClassWaits(SootMethod currentMd, SynchroStmt notifySynStmt) {
03543 Set waitStmtTreeNodeSet = new ArraySet();
03544 for (Iterator sootIt = Slicer.sootMethodInfoMap.keySet().iterator(); sootIt.hasNext();) {
03545 SootMethod sootMethod = (SootMethod) sootIt.next();
03546 if (sootMethod.equals(currentMd))
03547 continue;
03548 MethodInfo methodInfo = (MethodInfo) Slicer.sootMethodInfoMap.get(sootMethod);
03549 Set waitStmtSet = waitSetEffectedBy(methodInfo, notifySynStmt);
03550 Annotation mda = null;
03551 if (!waitStmtSet.isEmpty()) {
03552 try {
03553 mda = (Annotation) CompilationManager.getAnnotationManager().getAnnotation(methodInfo.sootClass, methodInfo.sootMethod);
03554 } catch (Exception ex) {
03555 System.out.println("There is an exception in geting Annotation");
03556 }
03557 }
03558 for (Iterator waitIt = waitStmtSet.iterator(); waitIt.hasNext();) {
03559 Stmt waitStmt = (Stmt) waitIt.next();
03560 Annotation waitAnn = null;
03561 try {
03562 waitAnn = mda.getContainingAnnotation(waitStmt);
03563 } catch (AnnotationException ae) {
03564 System.out.println("there is an AnnotationException! And enterMonitorStmtAnnotation may be null");
03565 }
03566 if (waitAnn != null)
03567 waitStmtTreeNodeSet.add(new StmtTreeNode(methodInfo.sootClass, mda, waitAnn));
03568 }
03569 }
03570 return waitStmtTreeNodeSet;
03571 }
03572 private DefaultMutableTreeNode getInterferDependAnns(boolean isPred) {
03573 DefaultMutableTreeNode interferRoot = null;
03574 if (isPred)
03575 interferRoot = new DefaultMutableTreeNode("Predecessors");
03576 else
03577 interferRoot = new DefaultMutableTreeNode("Successors");
03578 Set interferNodesForOneNode = new ArraySet();
03579 Annotation mda;
03580 if (currentNode instanceof StmtTreeNode) {
03581 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
03582 mda = startTreeNode.currentMethodDeclarationAnnotation;
03583 currentMethodDecAnn = mda;
03584 if (isPred)
03585 interferNodesForOneNode = getInterferPredNodesFor(mda, startTreeNode.currentStmtAnnotation);
03586 else
03587 {
03588 SootMethod sm = null;
03589 if (mda instanceof MethodDeclarationAnnotation)
03590 sm = ((MethodDeclarationAnnotation) mda).getSootMethod();
03591 else
03592 if (mda instanceof ConstructorDeclarationAnnotation)
03593 sm = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
03594 interferNodesForOneNode = getInterferSuccNodesFor(sm, startTreeNode.currentStmtAnnotation);
03595 }
03596 } else
03597 if (currentNode instanceof Annotation) {
03598 mda = currentMethodDecAnn;
03599 if (isPred)
03600 interferNodesForOneNode = getInterferPredNodesFor(mda, (Annotation) currentNode);
03601 else
03602 {
03603 SootMethod sm = null;
03604 if (mda instanceof MethodDeclarationAnnotation)
03605 sm = ((MethodDeclarationAnnotation) mda).getSootMethod();
03606 else
03607 if (mda instanceof ConstructorDeclarationAnnotation)
03608 sm = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
03609 interferNodesForOneNode = getInterferSuccNodesFor(sm, (Annotation) currentNode);
03610 }
03611 } else
03612 return interferRoot;
03613 if (interferNodesForOneNode.isEmpty())
03614 return interferRoot;
03615 Hashtable interferNodesForCurrentLevel = new Hashtable();
03616 interferNodesForCurrentLevel.put(interferRoot, interferNodesForOneNode);
03617 Hashtable interferNodesForNextLevel;
03618 do {
03619 interferNodesForNextLevel = new Hashtable();
03620 for (java.util.Iterator interferIt = interferNodesForCurrentLevel.keySet().iterator(); interferIt.hasNext();) {
03621 DefaultMutableTreeNode currentRootNode = (DefaultMutableTreeNode) interferIt.next();
03622 Set interferNodes = (Set) interferNodesForCurrentLevel.get(currentRootNode);
03623
03624 for (Iterator ifrIt = interferNodes.iterator(); ifrIt.hasNext();) {
03625 StmtTreeNode interferNode = (StmtTreeNode) ifrIt.next();
03626 if (!treePathContains(currentRootNode, interferNode)) {
03627 DefaultMutableTreeNode interferTreeNode = new DefaultMutableTreeNode(interferNode);
03628 currentRootNode.add(interferTreeNode);
03629 if (isPred)
03630 interferNodesForOneNode = getInterferPredNodesFor(mda, interferNode.currentStmtAnnotation);
03631 else
03632 {
03633 SootMethod sm = null;
03634 if (mda instanceof MethodDeclarationAnnotation)
03635 sm = ((MethodDeclarationAnnotation) mda).getSootMethod();
03636 else
03637 if (mda instanceof ConstructorDeclarationAnnotation)
03638 sm = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
03639 interferNodesForOneNode = getInterferSuccNodesFor(sm, interferNode.currentStmtAnnotation);
03640 }
03641 if (!interferNodesForOneNode.isEmpty())
03642 interferNodesForNextLevel.put(interferTreeNode, interferNodesForOneNode);
03643 }
03644 }
03645 }
03646 interferNodesForCurrentLevel = interferNodesForNextLevel;
03647 } while (!interferNodesForNextLevel.isEmpty());
03648 return interferRoot;
03649 }
03650
03651
03652
03653
03654
03655 private javax.swing.JLabel getInterferLabel() {
03656 if (ivjInterferLabel == null) {
03657 try {
03658 ivjInterferLabel = new javax.swing.JLabel();
03659 ivjInterferLabel.setName("InterferLabel");
03660 ivjInterferLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/interfer.jpg")));
03661 ivjInterferLabel.setText("");
03662 ivjInterferLabel.setBackground(new java.awt.Color(204,204,255));
03663 ivjInterferLabel.setForeground(java.awt.Color.black);
03664
03665
03666 } catch (java.lang.Throwable ivjExc) {
03667
03668
03669 handleException(ivjExc);
03670 }
03671 }
03672 return ivjInterferLabel;
03673 }
03674
03675
03676
03677
03678
03679 private javax.swing.JCheckBox getInterferPredCheckBox() {
03680 if (ivjInterferPredCheckBox == null) {
03681 try {
03682 ivjInterferPredCheckBox = new javax.swing.JCheckBox();
03683 ivjInterferPredCheckBox.setName("InterferPredCheckBox");
03684 ivjInterferPredCheckBox.setText("");
03685 ivjInterferPredCheckBox.setBackground(new java.awt.Color(204,204,255));
03686
03687
03688 } catch (java.lang.Throwable ivjExc) {
03689
03690
03691 handleException(ivjExc);
03692 }
03693 }
03694 return ivjInterferPredCheckBox;
03695 }
03696 private Set getInterferPredNodesFor(Annotation mda, Annotation stmtAnnotation) {
03697 Set dependAnnotations = new ArraySet();
03698 SootMethod sootMethod = null;
03699 if (mda instanceof MethodDeclarationAnnotation)
03700 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
03701 else
03702 if (mda instanceof ConstructorDeclarationAnnotation)
03703 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
03704 Map sootMap = Slicer.sootMethodInfoMap;
03705 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
03706 BuildPDG methodPDG = methodInfo.methodPDG;
03707 Map interferDependMap = methodPDG.getInterferenceMap();
03708 if (interferDependMap == null)
03709 return dependAnnotations;
03710 Stmt stmtsInAnnotation[];
03711 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
03712 stmtsInAnnotation = new Stmt[1];
03713 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
03714 } else
03715 if (stmtAnnotation instanceof ConditionalAnnotation) {
03716 stmtsInAnnotation = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
03717 } else
03718 if (stmtAnnotation instanceof ControlFlowAnnotation) {
03719 stmtsInAnnotation = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
03720 } else
03721 stmtsInAnnotation = stmtAnnotation.getStatements();
03722 for (int i = 0; i < stmtsInAnnotation.length; i++) {
03723 if (!interferDependMap.containsKey(stmtsInAnnotation[i]))
03724 continue;
03725 List interferDependStmt = (List) interferDependMap.get(stmtsInAnnotation[i]);
03726 for (Iterator interferIt = interferDependStmt.iterator(); interferIt.hasNext();) {
03727 InterferStmt interferStmt = (InterferStmt) interferIt.next();
03728 MethodInfo interferStmtMdInfo = interferStmt.methodInfo;
03729 Stmt interStmt = interferStmt.interferStmt;
03730 Annotation interStmtAnnotation = null;
03731
03732
03733
03734
03735
03736
03737
03738
03739
03740
03741
03742
03743
03744
03745
03746
03747
03748
03749
03750
03751
03752 try {
03753 interStmtAnnotation = Slicer.annManagerForSlicer.getContainingAnnotation(interferStmtMdInfo.sootClass, interferStmtMdInfo.sootMethod, interStmt);
03754 } catch (AnnotationException ae) {
03755 System.out.println("there is an AnnotationException! And interReadyStmtAnnotation may be null");
03756 }
03757
03758 if (!interStmtAnnotation.equals(stmtAnnotation)) {
03759 if (!interStmtAnnotation.toString().equals("")) {
03760 Annotation interferMdDec = Slicer.annManagerForSlicer.getAnnotation(interferStmtMdInfo.sootClass, interferStmtMdInfo.sootMethod);
03761 dependAnnotations.add(new StmtTreeNode(interferStmtMdInfo.sootClass, interferMdDec, interStmtAnnotation));
03762 }
03763 }
03764 }
03765 }
03766 return dependAnnotations;
03767 }
03768
03769
03770
03771
03772
03773 private javax.swing.JCheckBox getInterferSuccCheckBox() {
03774 if (ivjInterferSuccCheckBox == null) {
03775 try {
03776 ivjInterferSuccCheckBox = new javax.swing.JCheckBox();
03777 ivjInterferSuccCheckBox.setName("InterferSuccCheckBox");
03778 ivjInterferSuccCheckBox.setText("");
03779 ivjInterferSuccCheckBox.setBackground(new java.awt.Color(204,204,255));
03780
03781
03782 } catch (java.lang.Throwable ivjExc) {
03783
03784
03785 handleException(ivjExc);
03786 }
03787 }
03788 return ivjInterferSuccCheckBox;
03789 }
03790 private Set getInterferSuccNodesFor(SootMethod currentMd, Annotation stmtAnnotation) {
03791 Set dependAnnotations = new ArraySet();
03792 if ((stmtAnnotation instanceof SynchronizedStmtAnnotation) || (stmtAnnotation instanceof ConditionalAnnotation) || (stmtAnnotation instanceof ControlFlowAnnotation))
03793 return dependAnnotations;
03794 Map sootMap = Slicer.sootMethodInfoMap;
03795 Stmt stmtsInAnnotation[] = stmtAnnotation.getStatements();
03796 Set stmtSetInAnnotation = new ArraySet();
03797 for (int i = 0; i < stmtsInAnnotation.length; i++)
03798 stmtSetInAnnotation.add(stmtsInAnnotation[i]);
03799 for (Iterator sootIt = sootMap.keySet().iterator(); sootIt.hasNext();) {
03800 SootMethod sootMethod = (SootMethod) sootIt.next();
03801 if (sootMethod.equals(currentMd))
03802 continue;
03803 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
03804 BuildPDG methodPDG = methodInfo.methodPDG;
03805 Map interferDependMap = methodPDG.getInterferenceMap();
03806 if (interferDependMap == null)
03807 continue;
03808 Set stmtSet = stmtSetEffectedBy(interferDependMap, stmtSetInAnnotation);
03809 Annotation mda = null;
03810 if (!stmtSet.isEmpty()) {
03811 try {
03812 mda = (Annotation) CompilationManager.getAnnotationManager().getAnnotation(methodInfo.sootClass, methodInfo.sootMethod);
03813 } catch (Exception ex) {
03814 }
03815 }
03816 for (Iterator stmtIt = stmtSet.iterator(); stmtIt.hasNext();) {
03817 Stmt stmt = (Stmt) stmtIt.next();
03818 Annotation interStmtAnnotation = null;
03819 try {
03820 interStmtAnnotation = mda.getContainingAnnotation(stmt);
03821 } catch (AnnotationException ae) {
03822 System.out.println("there is an AnnotationException! And interReadyStmtAnnotation may be null");
03823 }
03824 if (!interStmtAnnotation.equals(stmtAnnotation))
03825 if (!interStmtAnnotation.toString().equals("")) {
03826 dependAnnotations.add(new StmtTreeNode(methodInfo.sootClass, mda, interStmtAnnotation));
03827 }
03828 }
03829 }
03830 return dependAnnotations;
03831 }
03832 private Set getInterReadyNodesFor(Annotation mda, Annotation stmtAnnotation) {
03833 Set dependAnnotations = new ArraySet();
03834 SootMethod sootMethod = null;
03835 if (mda instanceof MethodDeclarationAnnotation)
03836 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
03837 else
03838 if (mda instanceof ConstructorDeclarationAnnotation)
03839 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
03840 Map sootMap = Slicer.sootMethodInfoMap;
03841 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
03842 BuildPDG methodPDG = methodInfo.methodPDG;
03843 Map readyDependMap = methodPDG.getReadyDependMap();
03844 if (readyDependMap == null)
03845 return dependAnnotations;
03846 Stmt[] stmtsInAnnotation;
03847 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
03848 stmtsInAnnotation = new Stmt[1];
03849 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
03850 } else
03851 if (stmtAnnotation instanceof ConditionalAnnotation) {
03852 stmtsInAnnotation = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
03853 } else
03854 if (stmtAnnotation instanceof ControlFlowAnnotation) {
03855 stmtsInAnnotation = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
03856 } else
03857 stmtsInAnnotation = stmtAnnotation.getStatements();
03858 for (int i = 0; i < stmtsInAnnotation.length; i++) {
03859 if (!readyDependMap.containsKey(stmtsInAnnotation[i]))
03860 continue;
03861 List readyDependStmt = (List) readyDependMap.get(stmtsInAnnotation[i]);
03862 for (Iterator readyIt = readyDependStmt.iterator(); readyIt.hasNext();) {
03863 ReadyDependStmt readyStmt = (ReadyDependStmt) readyIt.next();
03864 MethodInfo readyStmtMdInfo = readyStmt.methodInfo;
03865 Stmt interReadyStmt = readyStmt.readyOnStmt;
03866 Annotation readyStmtAnnotation = null;
03867
03868 if (interReadyStmt instanceof ExitMonitorStmt) {
03869
03870
03871 LockAnalysis lockAnalysisForReadyStmt = readyStmtMdInfo.methodPDG.getLockAnalysis();
03872 MonitorPair mp = lockAnalysisForReadyStmt.getMonitorPair(interReadyStmt);
03873 Annotation bodyAnnotation = mp.getSynchroBodyAnn();
03874 Vector bodyAnns = bodyAnnotation.getAllAnnotations(true);
03875 int indexOfLast = bodyAnns.lastIndexOf(bodyAnns.lastElement());
03876 readyStmtAnnotation = (Annotation) bodyAnns.get(indexOfLast - 1);
03877 } else {
03878 try {
03879 readyStmtAnnotation = Slicer.annManagerForSlicer.getContainingAnnotation(readyStmtMdInfo.sootClass, readyStmtMdInfo.sootMethod,interReadyStmt);
03880 } catch (AnnotationException ae) {
03881 System.out.println("there is an AnnotationException! And interReadyStmtAnnotation may be null");
03882 }
03883 }
03884 if (!readyStmtAnnotation.toString().equals("")) {
03885 Annotation readyMdDec = Slicer.annManagerForSlicer.getAnnotation(readyStmtMdInfo.sootClass, readyStmtMdInfo.sootMethod);
03886 dependAnnotations.add(new StmtTreeNode(readyStmtMdInfo.sootClass, readyMdDec, readyStmtAnnotation));
03887 }
03888 }
03889 }
03890 return dependAnnotations;
03891 }
03892
03893
03894
03895
03896
03897 private javax.swing.JButton getNopredButton() {
03898 if (ivjNopredButton == null) {
03899 try {
03900 ivjNopredButton = new javax.swing.JButton();
03901 ivjNopredButton.setName("NopredButton");
03902 ivjNopredButton.setBorder(new javax.swing.border.CompoundBorder());
03903 ivjNopredButton.setText("No pred");
03904 ivjNopredButton.setBackground(new java.awt.Color(204,204,255));
03905 ivjNopredButton.setFont(new java.awt.Font("dialog.plain", 0, 12));
03906 ivjNopredButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
03907
03908
03909 } catch (java.lang.Throwable ivjExc) {
03910
03911
03912 handleException(ivjExc);
03913 }
03914 }
03915 return ivjNopredButton;
03916 }
03917
03918
03919
03920
03921
03922 private javax.swing.JButton getNosuccButton() {
03923 if (ivjNosuccButton == null) {
03924 try {
03925 ivjNosuccButton = new javax.swing.JButton();
03926 ivjNosuccButton.setName("NosuccButton");
03927 ivjNosuccButton.setBorder(new javax.swing.border.CompoundBorder());
03928 ivjNosuccButton.setText("No succ");
03929 ivjNosuccButton.setBackground(new java.awt.Color(204,204,255));
03930 ivjNosuccButton.setFont(new java.awt.Font("dialog.plain", 0, 12));
03931 ivjNosuccButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
03932
03933
03934 } catch (java.lang.Throwable ivjExc) {
03935
03936
03937 handleException(ivjExc);
03938 }
03939 }
03940 return ivjNosuccButton;
03941 }
03942
03943
03944
03945
03946
03947 private Hashtable getNotifyWaitStmtAnnotations(Annotation mda, List nwStmtList) {
03948 Hashtable anns = new Hashtable();
03949 for (Iterator nwStmtIt = nwStmtList.iterator(); nwStmtIt.hasNext();) {
03950 SynchroStmt nwSynStmt = (SynchroStmt) nwStmtIt.next();
03951 Stmt nwJimpleStmt = nwSynStmt.getWaitNotify();
03952 Annotation nwAnn = null;
03953 try {
03954 nwAnn = mda.getContainingAnnotation(nwJimpleStmt);
03955 } catch (AnnotationException ae) {
03956 System.out.println("there is an AnnotationException! And notifyStmtAnnotation may be null");
03957 }
03958 if (nwAnn != null)
03959 anns.put(nwAnn, nwSynStmt);
03960 }
03961 return anns;
03962 }
03963
03964
03965
03966
03967
03968 private javax.swing.JPanel getOperationPanel() {
03969 if (ivjOperationPanel == null) {
03970 try {
03971 ivjOperationPanel = new javax.swing.JPanel();
03972 ivjOperationPanel.setName("OperationPanel");
03973 ivjOperationPanel.setPreferredSize(new java.awt.Dimension(0, 235));
03974 ivjOperationPanel.setLayout(new java.awt.BorderLayout());
03975 ivjOperationPanel.setBackground(new java.awt.Color(204,204,255));
03976 getOperationPanel().add(getToolBarPanel(), "North");
03977 getOperationPanel().add(getCheckBoxesPanel(), "Center");
03978
03979
03980 } catch (java.lang.Throwable ivjExc) {
03981
03982
03983 handleException(ivjExc);
03984 }
03985 }
03986 return ivjOperationPanel;
03987 }
03988 private Set getReadyDependAnnotationsFor(Annotation mda, Annotation stmtAnnotation) {
03989 Set dependAnnotations = new ArraySet();
03990 SootMethod sootMethod = null;
03991 if (mda instanceof MethodDeclarationAnnotation)
03992 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
03993 else
03994 if (mda instanceof ConstructorDeclarationAnnotation)
03995 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
03996 Map sootMap = Slicer.sootMethodInfoMap;
03997 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
03998 StmtList stmtList = methodInfo.originalStmtList;
03999 BuildPDG methodPDG = methodInfo.methodPDG;
04000 LockAnalysis lockAnalysis = methodPDG.getLockAnalysis();
04001 if (lockAnalysis == null)
04002 return dependAnnotations;
04003 Stmt stmtsInAnnotation[];
04004 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
04005 stmtsInAnnotation = new Stmt[1];
04006 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
04007 } else
04008 if (stmtAnnotation instanceof ConditionalAnnotation) {
04009 stmtsInAnnotation = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
04010 } else
04011 if (stmtAnnotation instanceof ControlFlowAnnotation) {
04012 stmtsInAnnotation = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
04013 } else
04014 stmtsInAnnotation = stmtAnnotation.getStatements();
04015
04016
04017 for (int i = 0; i < stmtsInAnnotation.length; i++) {
04018 BitSet waitSet = lockAnalysis.readyDependOnWaits(stmtsInAnnotation[i]);
04019 Set waitStmtSet = SetUtil.bitSetToStmtSet(waitSet, stmtList);
04020
04021 for (Iterator waitIt = waitStmtSet.iterator(); waitIt.hasNext();) {
04022 Stmt waitStmt = (Stmt) waitIt.next();
04023 Annotation waitAnn = null;
04024 try {
04025 waitAnn = mda.getContainingAnnotation(waitStmt);
04026 } catch (AnnotationException ae) {
04027 System.out.println("there is an AnnotationException! And enterMonitorStmtAnnotation may be null");
04028 }
04029 if (waitAnn != null)
04030 dependAnnotations.add(waitAnn);
04031 }
04032 }
04033 return dependAnnotations;
04034 }
04035 private DefaultMutableTreeNode getReadyDependAnns(boolean isPred) {
04036 if (!isPred)
04037 return getReadySuccDependAnns();
04038 DefaultMutableTreeNode readyRoot = new DefaultMutableTreeNode("Predecessors");
04039 Set readyAnnotationsForOneNode;
04040 Annotation mda;
04041 Annotation currentAnn;
04042 if (currentNode instanceof StmtTreeNode) {
04043 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
04044 mda = startTreeNode.currentMethodDeclarationAnnotation;
04045 currentMethodDecAnn = mda;
04046 currentAnn = startTreeNode.currentStmtAnnotation;
04047 readyAnnotationsForOneNode = getReadyDependAnnotationsFor(mda, currentAnn);
04048 } else
04049 if (currentNode instanceof Annotation) {
04050 mda = currentMethodDecAnn;
04051 currentAnn = (Annotation) currentNode;
04052 readyAnnotationsForOneNode = getReadyDependAnnotationsFor(mda, currentAnn);
04053 } else
04054 return readyRoot;
04055 Hashtable waitAnnNode = new Hashtable();
04056 for (Iterator readyIt = readyAnnotationsForOneNode.iterator(); readyIt.hasNext();) {
04057 Annotation waitAnn = (Annotation) readyIt.next();
04058 DefaultMutableTreeNode waitNode = new DefaultMutableTreeNode(waitAnn);
04059 readyRoot.add(waitNode);
04060 waitAnnNode.put(waitAnn, waitNode);
04061
04062
04063
04064
04065
04066
04067
04068
04069
04070 }
04071
04072
04073
04074
04075 Hashtable readyNodesForCurrentLevel = new Hashtable();
04076 if (waitAnnNode.isEmpty()) {
04077
04078 Set interReadyNodesForOneNode = getInterReadyNodesFor(mda, currentAnn);
04079 if (interReadyNodesForOneNode.isEmpty()) {
04080
04081
04082 return readyRoot;
04083 } else {
04084
04085
04086 readyNodesForCurrentLevel.put(readyRoot, interReadyNodesForOneNode);
04087 }
04088 } else {
04089 for (java.util.Iterator waitIt = waitAnnNode.keySet().iterator(); waitIt.hasNext();) {
04090 Annotation waitAnn = (Annotation) waitIt.next();
04091 Set interReadyNodesForOneNode = getInterReadyNodesFor(mda, waitAnn);
04092 readyNodesForCurrentLevel.put(waitAnnNode.get(waitAnn), interReadyNodesForOneNode);
04093 }
04094 }
04095 if (currentAnn instanceof SynchronizedStmtAnnotation) {
04096 Set interReadyNodesForRoot = getInterReadyNodesFor(mda, currentAnn);
04097 if (!interReadyNodesForRoot.isEmpty())
04098 readyNodesForCurrentLevel.put(readyRoot, interReadyNodesForRoot);
04099 }
04100
04101
04102 Hashtable readyNodesForNextLevel;
04103 do {
04104 readyNodesForNextLevel = new Hashtable();
04105 for (java.util.Iterator readyIt = readyNodesForCurrentLevel.keySet().iterator(); readyIt.hasNext();) {
04106 DefaultMutableTreeNode currentRootNode = (DefaultMutableTreeNode) readyIt.next();
04107 Set readyNodes = (Set) readyNodesForCurrentLevel.get(currentRootNode);
04108
04109 for (Iterator rdIt = readyNodes.iterator(); rdIt.hasNext();) {
04110 StmtTreeNode rdNode = (StmtTreeNode) rdIt.next();
04111 if (!treePathContains(currentRootNode, rdNode)) {
04112 DefaultMutableTreeNode rdTreeNode = new DefaultMutableTreeNode(rdNode);
04113 currentRootNode.add(rdTreeNode);
04114 Set interReadyNodesForOneNode = getInterReadyNodesFor(rdNode.currentMethodDeclarationAnnotation, rdNode.currentStmtAnnotation);
04115 if (!interReadyNodesForOneNode.isEmpty())
04116 readyNodesForNextLevel.put(rdTreeNode, interReadyNodesForOneNode);
04117 }
04118 }
04119 }
04120 readyNodesForCurrentLevel = readyNodesForNextLevel;
04121 } while (!readyNodesForNextLevel.isEmpty());
04122 return readyRoot;
04123 }
04124
04125
04126
04127
04128
04129 private javax.swing.JLabel getReadyLabel() {
04130 if (ivjReadyLabel == null) {
04131 try {
04132 ivjReadyLabel = new javax.swing.JLabel();
04133 ivjReadyLabel.setName("ReadyLabel");
04134 ivjReadyLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/ready.jpg")));
04135 ivjReadyLabel.setText("");
04136 ivjReadyLabel.setBackground(new java.awt.Color(204,204,255));
04137 ivjReadyLabel.setForeground(java.awt.Color.black);
04138
04139
04140 } catch (java.lang.Throwable ivjExc) {
04141
04142
04143 handleException(ivjExc);
04144 }
04145 }
04146 return ivjReadyLabel;
04147 }
04148
04149
04150
04151
04152
04153 private javax.swing.JCheckBox getReadyPredCheckBox() {
04154 if (ivjReadyPredCheckBox == null) {
04155 try {
04156 ivjReadyPredCheckBox = new javax.swing.JCheckBox();
04157 ivjReadyPredCheckBox.setName("ReadyPredCheckBox");
04158 ivjReadyPredCheckBox.setText("");
04159 ivjReadyPredCheckBox.setBackground(new java.awt.Color(204,204,255));
04160
04161
04162 } catch (java.lang.Throwable ivjExc) {
04163
04164
04165 handleException(ivjExc);
04166 }
04167 }
04168 return ivjReadyPredCheckBox;
04169 }
04170
04171
04172
04173
04174
04175 private javax.swing.JCheckBox getReadySuccCheckBox() {
04176 if (ivjReadySuccCheckBox == null) {
04177 try {
04178 ivjReadySuccCheckBox = new javax.swing.JCheckBox();
04179 ivjReadySuccCheckBox.setName("ReadySuccCheckBox");
04180 ivjReadySuccCheckBox.setText("");
04181 ivjReadySuccCheckBox.setBackground(new java.awt.Color(204,204,255));
04182
04183
04184 } catch (java.lang.Throwable ivjExc) {
04185
04186
04187 handleException(ivjExc);
04188 }
04189 }
04190 return ivjReadySuccCheckBox;
04191 }
04192 private Set getReadySuccDependAnnotationsFor(Annotation mda, Annotation stmtAnnotation) {
04193 Set dependAnnotations = new ArraySet();
04194 SootMethod sootMethod = null;
04195 if (mda instanceof MethodDeclarationAnnotation)
04196 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
04197 else
04198 if (mda instanceof ConstructorDeclarationAnnotation)
04199 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
04200 Map sootMap = Slicer.sootMethodInfoMap;
04201 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
04202 StmtList stmtList = methodInfo.originalStmtList;
04203 BuildPDG methodPDG = methodInfo.methodPDG;
04204 LockAnalysis lockAnalysis = methodPDG.getLockAnalysis();
04205 if (lockAnalysis == null)
04206 return dependAnnotations;
04207
04208
04209
04210
04211
04212
04213 List notifyStmtList = lockAnalysis.getNotifyStmtList();
04214 List waitStmtList = lockAnalysis.getWaitStmtList();
04215
04216
04217
04218
04219
04220
04221
04222
04223
04224
04225
04226
04227
04228
04229 Hashtable waitStmtAnnotations = getNotifyWaitStmtAnnotations(mda, waitStmtList);
04230 if (waitStmtAnnotations.containsKey(stmtAnnotation)) {
04231
04232 SynchroStmt waitStmt = (SynchroStmt) waitStmtAnnotations.get(stmtAnnotation);
04233 Stmt waitJimpleStmt = waitStmt.getWaitNotify();
04234 BitSet reachableStmts = lockAnalysis.reachableStmtFrom(waitJimpleStmt);
04235 for (int j = 0; j < stmtList.size(); j++) {
04236 if (reachableStmts.get(j)) {
04237 Stmt stmt = (Stmt) stmtList.get(j);
04238 Annotation reachableStmtAnnotation = null;
04239 try {
04240 reachableStmtAnnotation = mda.getContainingAnnotation(stmt);
04241 } catch (AnnotationException ae) {
04242 System.out.println("there is an AnnotationException! And reachable StmtAnnotation may be null");
04243 }
04244 if (!reachableStmtAnnotation.equals(stmtAnnotation)) {
04245 if (!reachableStmtAnnotation.toString().equals(""))
04246 dependAnnotations.add(reachableStmtAnnotation);
04247 }
04248 }
04249 }
04250 return dependAnnotations;
04251 }
04252
04253 List monitorPairList = lockAnalysis.getLockPairList();
04254 Hashtable exitMonitorAnnotations = getExitMonitorAnnotations(mda, monitorPairList);
04255 if (exitMonitorAnnotations.containsKey(stmtAnnotation)) {
04256
04257 MonitorPair mp = (MonitorPair) exitMonitorAnnotations.get(stmtAnnotation);
04258 Set exitMonitors = lockAnalysis.exitMonitorsIn(mp);
04259 Stmt enterMonitor = (Stmt) mp.getEnterMonitor();
04260 Annotation enterMonitorAnnotation = null;
04261 try {
04262 enterMonitorAnnotation = mda.getContainingAnnotation(enterMonitor);
04263 } catch (AnnotationException ae) {
04264 System.out.println("there is an AnnotationException! And enterMonitorAnnotation may be null");
04265 }
04266 if (enterMonitorAnnotation != null)
04267 dependAnnotations.add(enterMonitorAnnotation);
04268
04269
04270 Set enterSet = getInterClassEnterMonitors(sootMethod, exitMonitors);
04271 dependAnnotations.addAll(enterSet);
04272 return dependAnnotations;
04273 }
04274 return dependAnnotations;
04275 }
04276 private DefaultMutableTreeNode getReadySuccDependAnns() {
04277 DefaultMutableTreeNode readyRoot = new DefaultMutableTreeNode("Successors");
04278 Set readyAnnotationsForOneNode;
04279 Annotation mda;
04280 Annotation currentAnn;
04281 if (currentNode instanceof StmtTreeNode) {
04282 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
04283 mda = startTreeNode.currentMethodDeclarationAnnotation;
04284 currentMethodDecAnn = mda;
04285 currentAnn = startTreeNode.currentStmtAnnotation;
04286 readyAnnotationsForOneNode = getReadySuccDependAnnotationsFor(mda, currentAnn);
04287 } else
04288 if (currentNode instanceof Annotation) {
04289 mda = currentMethodDecAnn;
04290 currentAnn = (Annotation) currentNode;
04291 readyAnnotationsForOneNode = getReadySuccDependAnnotationsFor(mda, currentAnn);
04292 } else
04293 return readyRoot;
04294
04295
04296
04297
04298 Hashtable readyNodesForCurrentLevel = new Hashtable();
04299 if (!readyAnnotationsForOneNode.isEmpty())
04300 readyNodesForCurrentLevel.put(readyRoot, readyAnnotationsForOneNode);
04301 else
04302 return readyRoot;
04303 Hashtable readyNodesForNextLevel;
04304 do {
04305 readyNodesForNextLevel = new Hashtable();
04306 for (java.util.Iterator readyIt = readyNodesForCurrentLevel.keySet().iterator(); readyIt.hasNext();) {
04307 DefaultMutableTreeNode currentRootNode = (DefaultMutableTreeNode) readyIt.next();
04308 Set readyNodes = (Set) readyNodesForCurrentLevel.get(currentRootNode);
04309
04310 for (Iterator rdIt = readyNodes.iterator(); rdIt.hasNext();) {
04311 Object rdNode = rdIt.next();
04312 if (!treePathContains(currentRootNode, rdNode)) {
04313 DefaultMutableTreeNode rdTreeNode = new DefaultMutableTreeNode(rdNode);
04314 currentRootNode.add(rdTreeNode);
04315 Set interReadyNodesForOneNode = null;
04316 if (rdNode instanceof StmtTreeNode) {
04317 StmtTreeNode stmtRdNode = (StmtTreeNode) rdNode;
04318 interReadyNodesForOneNode = getReadySuccDependAnnotationsFor(stmtRdNode.currentMethodDeclarationAnnotation, stmtRdNode.currentStmtAnnotation);
04319 } else
04320 if (rdNode instanceof Annotation) {
04321
04322 Annotation parentMda = (Annotation) CompilationManager.getAnnotationManager().getMethodAnnotationContainingAnnotation((Annotation) rdNode);
04323 interReadyNodesForOneNode = getReadySuccDependAnnotationsFor(parentMda, (Annotation) rdNode);
04324 } else {
04325 System.out.println("rdNode should be StmtTreeNode or Annotation");
04326 }
04327 if (!interReadyNodesForOneNode.isEmpty())
04328 readyNodesForNextLevel.put(rdTreeNode, interReadyNodesForOneNode);
04329 }
04330 }
04331 }
04332 readyNodesForCurrentLevel = readyNodesForNextLevel;
04333 } while (!readyNodesForNextLevel.isEmpty());
04334 return readyRoot;
04335 }
04336
04337
04338
04339
04340
04341
04342 private Set getRefValueSetFrom(Stmt[] stmts) {
04343 Set refValueSet = new ArraySet();
04344 for (int i = 0; i < stmts.length; i++) {
04345 Stmt stmt = stmts[i];
04346 for (Iterator boxIt = stmt.getUseBoxes().iterator(); boxIt.hasNext();) {
04347 ValueBox valueBox = (ValueBox) boxIt.next();
04348 Value value = valueBox.getValue();
04349 if ((value instanceof InvokeExpr) || (value instanceof Constant) || (value instanceof BinopExpr) ||(value instanceof NewExpr)) continue;
04350 if ((value.getType() instanceof RefType) || (value.getType() instanceof ArrayType))
04351 refValueSet.add(value);
04352 }
04353 }
04354 return refValueSet;
04355 }
04356 private DefaultMutableTreeNode getSynchDependAnns(boolean isPred) {
04357 if (!isPred)
04358 return getSynchSuccDependAnns();
04359 DefaultMutableTreeNode synchRoot = new DefaultMutableTreeNode("Predecessors");
04360 Set synchAnnotationsForOneNode;
04361 Annotation mda;
04362 Annotation currentAnn;
04363 if (currentNode instanceof StmtTreeNode) {
04364 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
04365 mda = startTreeNode.currentMethodDeclarationAnnotation;
04366 currentMethodDecAnn = mda;
04367 currentAnn = startTreeNode.currentStmtAnnotation;
04368 synchAnnotationsForOneNode = getSynchPredDependAnnotationsFor(mda, currentAnn);
04369 } else
04370 if (currentNode instanceof Annotation) {
04371 mda = currentMethodDecAnn;
04372 currentAnn = (Annotation) currentNode;
04373 synchAnnotationsForOneNode = getSynchPredDependAnnotationsFor(mda, currentAnn);
04374 } else
04375 return synchRoot;
04376 if (synchAnnotationsForOneNode.isEmpty())
04377 return synchRoot;
04378 for (Iterator synIt = synchAnnotationsForOneNode.iterator(); synIt.hasNext();) {
04379 Annotation enterMonitorAnn = (Annotation) synIt.next();
04380 DefaultMutableTreeNode enterMonitorNode = new DefaultMutableTreeNode(enterMonitorAnn);
04381
04382
04383
04384
04385
04386 synchRoot.add(enterMonitorNode);
04387
04388
04389
04390
04391
04392
04393
04394
04395
04396
04397 }
04398 return synchRoot;
04399 }
04400
04401
04402
04403
04404
04405 private javax.swing.JLabel getSynchLabel() {
04406 if (ivjSynchLabel == null) {
04407 try {
04408 ivjSynchLabel = new javax.swing.JLabel();
04409 ivjSynchLabel.setName("SynchLabel");
04410 ivjSynchLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/ksu/cis/bandera/pdgslicer/dependency/images/synchro.jpg")));
04411 ivjSynchLabel.setText("");
04412 ivjSynchLabel.setBackground(new java.awt.Color(204,204,255));
04413 ivjSynchLabel.setForeground(java.awt.Color.black);
04414
04415
04416 } catch (java.lang.Throwable ivjExc) {
04417
04418
04419 handleException(ivjExc);
04420 }
04421 }
04422 return ivjSynchLabel;
04423 }
04424
04425
04426
04427
04428
04429 private javax.swing.JCheckBox getSynchPredCheckBox() {
04430 if (ivjSynchPredCheckBox == null) {
04431 try {
04432 ivjSynchPredCheckBox = new javax.swing.JCheckBox();
04433 ivjSynchPredCheckBox.setName("SynchPredCheckBox");
04434 ivjSynchPredCheckBox.setText("");
04435 ivjSynchPredCheckBox.setBackground(new java.awt.Color(204,204,255));
04436
04437
04438 } catch (java.lang.Throwable ivjExc) {
04439
04440
04441 handleException(ivjExc);
04442 }
04443 }
04444 return ivjSynchPredCheckBox;
04445 }
04446 private Set getSynchPredDependAnnotationsFor(Annotation mda, Annotation stmtAnnotation) {
04447 Set dependAnnotations = new ArraySet();
04448 SootMethod sootMethod = null;
04449 if (mda instanceof MethodDeclarationAnnotation)
04450 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
04451 else
04452 if (mda instanceof ConstructorDeclarationAnnotation)
04453 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
04454 Map sootMap = Slicer.sootMethodInfoMap;
04455 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
04456 BuildPDG methodPDG = methodInfo.methodPDG;
04457 LockAnalysis lockAnalysis = methodPDG.getLockAnalysis();
04458 if (lockAnalysis == null)
04459 return dependAnnotations;
04460 Stmt stmtsInAnnotation[];
04461 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
04462 stmtsInAnnotation = new Stmt[1];
04463 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
04464 } else
04465 if (stmtAnnotation instanceof ConditionalAnnotation) {
04466 stmtsInAnnotation = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
04467 } else
04468 if (stmtAnnotation instanceof ControlFlowAnnotation) {
04469 stmtsInAnnotation = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
04470 } else
04471 stmtsInAnnotation = stmtAnnotation.getStatements();
04472 for (int i = 0; i < stmtsInAnnotation.length; i++) {
04473 Hashtable monitorPairs = lockAnalysis.dependOnMonitorPairs(stmtsInAnnotation[i]);
04474 for (java.util.Iterator pairsIt = monitorPairs.keySet().iterator(); pairsIt.hasNext();) {
04475 Stmt enterMonitorStmt = (Stmt) pairsIt.next();
04476 Annotation enterAnn = null;
04477 try {
04478 enterAnn = mda.getContainingAnnotation(enterMonitorStmt);
04479 } catch (AnnotationException ae) {
04480 System.out.println("there is an AnnotationException! And enterMonitorStmtAnnotation may be null");
04481 }
04482 if (enterAnn != null)
04483 dependAnnotations.add(enterAnn);
04484 }
04485 }
04486 return dependAnnotations;
04487 }
04488
04489
04490
04491
04492
04493 private javax.swing.JCheckBox getSynchSuccCheckBox() {
04494 if (ivjSynchSuccCheckBox == null) {
04495 try {
04496 ivjSynchSuccCheckBox = new javax.swing.JCheckBox();
04497 ivjSynchSuccCheckBox.setName("SynchSuccCheckBox");
04498 ivjSynchSuccCheckBox.setText("");
04499 ivjSynchSuccCheckBox.setBackground(new java.awt.Color(204,204,255));
04500
04501
04502 } catch (java.lang.Throwable ivjExc) {
04503
04504
04505 handleException(ivjExc);
04506 }
04507 }
04508 return ivjSynchSuccCheckBox;
04509 }
04510 private Set getSynchSuccDependAnnotationsFor(Annotation mda, Annotation stmtAnnotation) {
04511 Set dependAnnotations = new ArraySet();
04512 SootMethod sootMethod = null;
04513 if (mda instanceof MethodDeclarationAnnotation)
04514 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
04515 else
04516 if (mda instanceof ConstructorDeclarationAnnotation)
04517 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
04518 Map sootMap = Slicer.sootMethodInfoMap;
04519 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
04520 StmtList stmtList = methodInfo.originalStmtList;
04521 BuildPDG methodPDG = methodInfo.methodPDG;
04522 LockAnalysis lockAnalysis = methodPDG.getLockAnalysis();
04523 if (lockAnalysis == null)
04524 return dependAnnotations;
04525
04526 List monitorPairList = lockAnalysis.getLockPairList();
04527 Hashtable exitMonitorAnnotations = getExitMonitorAnnotations(mda, monitorPairList);
04528 if (exitMonitorAnnotations.containsKey(stmtAnnotation)) {
04529
04530 MonitorPair mp = (MonitorPair) exitMonitorAnnotations.get(stmtAnnotation);
04531 Set exitMonitors = lockAnalysis.exitMonitorsIn(mp);
04532 Stmt enterMonitor = (Stmt) mp.getEnterMonitor();
04533 Annotation enterMonitorAnnotation = null;
04534 try {
04535 enterMonitorAnnotation = mda.getContainingAnnotation(enterMonitor);
04536 } catch (AnnotationException ae) {
04537 System.out.println("there is an AnnotationException! And enterMonitorAnnotation may be null");
04538 }
04539 if (enterMonitorAnnotation != null)
04540 dependAnnotations.add(enterMonitorAnnotation);
04541
04542
04543 Set enterSet = getInterClassEnterMonitors(sootMethod, exitMonitors);
04544 dependAnnotations.addAll(enterSet);
04545 }
04546 return dependAnnotations;
04547 }
04548 private DefaultMutableTreeNode getSynchSuccDependAnns() {
04549 DefaultMutableTreeNode synchRoot = new DefaultMutableTreeNode("Successors");
04550 Set synchAnnotationsForOneNode;
04551 Annotation mda;
04552 Annotation currentAnn;
04553 if (currentNode instanceof StmtTreeNode) {
04554 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
04555 mda = startTreeNode.currentMethodDeclarationAnnotation;
04556 currentMethodDecAnn = mda;
04557 currentAnn = startTreeNode.currentStmtAnnotation;
04558 synchAnnotationsForOneNode = getSynchSuccDependAnnotationsFor(mda, currentAnn);
04559 } else
04560 if (currentNode instanceof Annotation) {
04561 mda = currentMethodDecAnn;
04562 currentAnn = (Annotation) currentNode;
04563 synchAnnotationsForOneNode = getSynchSuccDependAnnotationsFor(mda, currentAnn);
04564 } else
04565 return synchRoot;
04566 if (synchAnnotationsForOneNode.isEmpty())
04567 return synchRoot;
04568 for (Iterator synIt = synchAnnotationsForOneNode.iterator(); synIt.hasNext();) {
04569 Object enterMonitorAnn = synIt.next();
04570 DefaultMutableTreeNode enterMonitorNode = new DefaultMutableTreeNode(enterMonitorAnn);
04571 synchRoot.add(enterMonitorNode);
04572 }
04573 return synchRoot;
04574 }
04575
04576
04577
04578
04579
04580 private javax.swing.JPanel getToolBarInPanel() {
04581 if (ivjToolBarInPanel == null) {
04582 try {
04583 ivjToolBarInPanel = new javax.swing.JPanel();
04584 ivjToolBarInPanel.setName("ToolBarInPanel");
04585 ivjToolBarInPanel.setLayout(new java.awt.GridBagLayout());
04586 ivjToolBarInPanel.setBackground(new java.awt.Color(204,204,255));
04587 ivjToolBarInPanel.setMaximumSize(new java.awt.Dimension(3000, 100));
04588 ivjToolBarInPanel.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN);
04589 ivjToolBarInPanel.setPreferredSize(new java.awt.Dimension(0, 50));
04590 ivjToolBarInPanel.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
04591 ivjToolBarInPanel.setMinimumSize(new java.awt.Dimension(228, 100));
04592
04593 java.awt.GridBagConstraints constraintsBackToolBarButton = new java.awt.GridBagConstraints();
04594 constraintsBackToolBarButton.gridx = 0; constraintsBackToolBarButton.gridy = 0;
04595 constraintsBackToolBarButton.insets = new java.awt.Insets(5, 5, 12, 10);
04596 getToolBarInPanel().add(getBackToolBarButton(), constraintsBackToolBarButton);
04597
04598 java.awt.GridBagConstraints constraintsForwardToolBarButton = new java.awt.GridBagConstraints();
04599 constraintsForwardToolBarButton.gridx = 1; constraintsForwardToolBarButton.gridy = 0;
04600 constraintsForwardToolBarButton.insets = new java.awt.Insets(5, 3, 12, 10);
04601 getToolBarInPanel().add(getForwardToolBarButton(), constraintsForwardToolBarButton);
04602
04603 java.awt.GridBagConstraints constraintsBackwardSliceToolBarButton = new java.awt.GridBagConstraints();
04604 constraintsBackwardSliceToolBarButton.gridx = 2; constraintsBackwardSliceToolBarButton.gridy = 0;
04605 constraintsBackwardSliceToolBarButton.insets = new java.awt.Insets(5, 3, 12, 10);
04606 getToolBarInPanel().add(getBackwardSliceToolBarButton(), constraintsBackwardSliceToolBarButton);
04607
04608 java.awt.GridBagConstraints constraintsForwardSliceToolBarButton = new java.awt.GridBagConstraints();
04609 constraintsForwardSliceToolBarButton.gridx = 3; constraintsForwardSliceToolBarButton.gridy = 0;
04610 constraintsForwardSliceToolBarButton.insets = new java.awt.Insets(5, 3, 12, 10);
04611 getToolBarInPanel().add(getForwardSliceToolBarButton(), constraintsForwardSliceToolBarButton);
04612
04613 java.awt.GridBagConstraints constraintsClearToolBarButton = new java.awt.GridBagConstraints();
04614 constraintsClearToolBarButton.gridx = 4; constraintsClearToolBarButton.gridy = 0;
04615 constraintsClearToolBarButton.gridwidth = 5;
04616 constraintsClearToolBarButton.anchor = java.awt.GridBagConstraints.EAST;
04617 constraintsClearToolBarButton.weightx = 1.0;
04618 constraintsClearToolBarButton.ipadx = 7;
04619 constraintsClearToolBarButton.insets = new java.awt.Insets(5, 3, 12, 0);
04620 getToolBarInPanel().add(getClearToolBarButton(), constraintsClearToolBarButton);
04621
04622
04623 } catch (java.lang.Throwable ivjExc) {
04624
04625
04626 handleException(ivjExc);
04627 }
04628 }
04629 return ivjToolBarInPanel;
04630 }
04631
04632
04633
04634
04635
04636 private javax.swing.JPanel getToolBarPanel() {
04637 if (ivjToolBarPanel == null) {
04638 try {
04639 ivjToolBarPanel = new javax.swing.JPanel();
04640 ivjToolBarPanel.setName("ToolBarPanel");
04641 ivjToolBarPanel.setPreferredSize(new java.awt.Dimension(0, 50));
04642 ivjToolBarPanel.setBorder(new javax.swing.border.EtchedBorder());
04643 ivjToolBarPanel.setLayout(new java.awt.BorderLayout());
04644 ivjToolBarPanel.setBackground(new java.awt.Color(204,204,255));
04645 getToolBarPanel().add(getDependOperationToolBar(), "Center");
04646
04647
04648 } catch (java.lang.Throwable ivjExc) {
04649
04650
04651 handleException(ivjExc);
04652 }
04653 }
04654 return ivjToolBarPanel;
04655 }
04656
04657
04658
04659
04660
04661 private javax.swing.JPanel getValueCheckBoxesPanel() {
04662 if (ivjValueCheckBoxesPanel == null) {
04663 try {
04664 ivjValueCheckBoxesPanel = new javax.swing.JPanel();
04665 ivjValueCheckBoxesPanel.setName("ValueCheckBoxesPanel");
04666 ivjValueCheckBoxesPanel.setLayout(getValueCheckBoxesPanelFlowLayout());
04667 ivjValueCheckBoxesPanel.setBackground(new java.awt.Color(204,204,255));
04668 getValueCheckBoxesPanel().add(getValuePredCheckBox(), getValuePredCheckBox().getName());
04669 getValueCheckBoxesPanel().add(getValueSuccCheckBox(), getValueSuccCheckBox().getName());
04670 getValueCheckBoxesPanel().add(getValueSetCheckBox(), getValueSetCheckBox().getName());
04671 getValueCheckBoxesPanel().add(getAllValuesButton(), getAllValuesButton().getName());
04672 getValueCheckBoxesPanel().add(getClearValuesButton(), getClearValuesButton().getName());
04673
04674
04675 } catch (java.lang.Throwable ivjExc) {
04676
04677
04678 handleException(ivjExc);
04679 }
04680 }
04681 return ivjValueCheckBoxesPanel;
04682 }
04683
04684
04685
04686
04687
04688 private java.awt.FlowLayout getValueCheckBoxesPanelFlowLayout() {
04689 java.awt.FlowLayout ivjValueCheckBoxesPanelFlowLayout = null;
04690 try {
04691
04692 ivjValueCheckBoxesPanelFlowLayout = new java.awt.FlowLayout();
04693 ivjValueCheckBoxesPanelFlowLayout.setAlignment(java.awt.FlowLayout.LEFT);
04694 ivjValueCheckBoxesPanelFlowLayout.setHgap(6);
04695 } catch (java.lang.Throwable ivjExc) {
04696 handleException(ivjExc);
04697 };
04698 return ivjValueCheckBoxesPanelFlowLayout;
04699 }
04700
04701
04702
04703
04704
04705 private javax.swing.JLabel getValueFlowLabel() {
04706 if (ivjValueFlowLabel == null) {
04707 try {
04708 ivjValueFlowLabel = new javax.swing.JLabel();
04709 ivjValueFlowLabel.setName("ValueFlowLabel");
04710 ivjValueFlowLabel.setText("Value Flow Graph : ");
04711 ivjValueFlowLabel.setForeground(java.awt.Color.black);
04712
04713
04714 } catch (java.lang.Throwable ivjExc) {
04715
04716
04717 handleException(ivjExc);
04718 }
04719 }
04720 return ivjValueFlowLabel;
04721 }
04722 private Hashtable getValuePredAnnotationsFor(Annotation mda, Annotation stmtAnnotation) {
04723 Hashtable valuePredAnnotations = new Hashtable();
04724 SootMethod sootMethod = null;
04725 if (mda instanceof MethodDeclarationAnnotation)
04726 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
04727 else
04728 if (mda instanceof ConstructorDeclarationAnnotation)
04729 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
04730 Map sootMap = Slicer.sootMethodInfoMap;
04731 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
04732 BuildPDG methodPDG = methodInfo.methodPDG;
04733 Stmt stmtsInAnnotation[];
04734 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
04735 stmtsInAnnotation = new Stmt[1];
04736 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
04737 } else
04738 if (stmtAnnotation instanceof ConditionalAnnotation) {
04739 stmtsInAnnotation = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
04740 } else
04741 if (stmtAnnotation instanceof ControlFlowAnnotation) {
04742 stmtsInAnnotation = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
04743 } else
04744 stmtsInAnnotation = stmtAnnotation.getStatements();
04745
04746
04747 Set varSet = collectVarsFromStmts(stmtsInAnnotation);
04748 for (Iterator valueIt = varSet.iterator(); valueIt.hasNext();) {
04749 Value value = (Value) valueIt.next();
04750 DefaultMutableTreeNode localNode = new DefaultMutableTreeNode(value);
04751 Collection valuePreds = this.BOFA_Analysis.getDefs(value, sootMethod);
04752
04753 Set predAnnotations = new ArraySet();
04754 for (Iterator stmtIt = valuePreds.iterator(); stmtIt.hasNext();) {
04755 edu.ksu.cis.bandera.bofa.Analysis.StmtMethodPair predStmtMethod = (edu.ksu.cis.bandera.bofa.Analysis.StmtMethodPair) stmtIt.next();
04756 Stmt predStmt = predStmtMethod.getStmt();
04757 if (predStmt instanceof IdentityStmt) {
04758 ParameterNode paraNode = new ParameterNode(methodInfo.sootClass, mda, (IdentityStmt) predStmt);
04759 predAnnotations.add(paraNode);
04760 } else {
04761 Annotation predStmtAnnotation = null;
04762 SootMethod methodEnclosingStmt = predStmtMethod.getSootMethod();
04763 Annotation methodAnnotation = null;
04764 if (methodEnclosingStmt.equals(sootMethod))
04765 methodAnnotation = mda;
04766 else
04767 methodAnnotation = CompilationManager.getAnnotationManager().getAnnotation(methodEnclosingStmt.getDeclaringClass(), methodEnclosingStmt);
04768 try {
04769 predStmtAnnotation = methodAnnotation.getContainingAnnotation(predStmt);
04770 } catch (AnnotationException ae) {
04771 System.out.println("there is an AnnotationException! And ddStmtAnnotation may be null");
04772 }
04773 if (predStmtAnnotation == null) {
04774
04775
04776
04777 } else {
04778 if (!predStmtAnnotation.toString().equals(""))
04779
04780
04781
04782
04783 predAnnotations.add(predStmtAnnotation);
04784 }
04785 }
04786 }
04787 valuePredAnnotations.put(localNode, predAnnotations);
04788 }
04789 return valuePredAnnotations;
04790 }
04791 private DefaultMutableTreeNode getValuePredAnns() {
04792 DefaultMutableTreeNode currentValuePredRoot = new DefaultMutableTreeNode("Value Predecessors");
04793 Hashtable valuePredAnnotationsForOneNode;
04794 Annotation mda;
04795 if (currentNode instanceof StmtTreeNode) {
04796 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
04797 mda = startTreeNode.currentMethodDeclarationAnnotation;
04798 currentMethodDecAnn = mda;
04799 valuePredAnnotationsForOneNode = getValuePredAnnotationsFor(mda, startTreeNode.currentStmtAnnotation);
04800 } else
04801 if (currentNode instanceof Annotation) {
04802 mda = currentMethodDecAnn;
04803 valuePredAnnotationsForOneNode = getValuePredAnnotationsFor(mda, (Annotation) currentNode);
04804 } else
04805 return currentValuePredRoot;
04806 if (valuePredAnnotationsForOneNode.isEmpty())
04807 return currentValuePredRoot;
04808 for (java.util.Iterator varIt = valuePredAnnotationsForOneNode.keySet().iterator(); varIt.hasNext();) {
04809 DefaultMutableTreeNode currentVarNode = (DefaultMutableTreeNode) varIt.next();
04810 currentValuePredRoot.add(currentVarNode);
04811 Set valuePredAnnotations = (Set) valuePredAnnotationsForOneNode.get(currentVarNode);
04812
04813 for (Iterator predIt = valuePredAnnotations.iterator(); predIt.hasNext();) {
04814 Object predObject = predIt.next();
04815 if (predObject instanceof ParameterNode) {
04816 DefaultMutableTreeNode paraNode = new DefaultMutableTreeNode(predObject);
04817 if (predObject.toString().equals("JJJCTEMP$0"))
04818 paraNode = new DefaultMutableTreeNode("this");
04819 currentVarNode.add(paraNode);
04820 } else {
04821 Annotation predAnn = (Annotation) predObject;
04822 DefaultMutableTreeNode predNode = new DefaultMutableTreeNode(predAnn);
04823 currentVarNode.add(predNode);
04824 }
04825 }
04826 }
04827 return currentValuePredRoot;
04828 }
04829
04830
04831
04832
04833
04834 private javax.swing.JCheckBox getValuePredCheckBox() {
04835 if (ivjValuePredCheckBox == null) {
04836 try {
04837 ivjValuePredCheckBox = new javax.swing.JCheckBox();
04838 ivjValuePredCheckBox.setName("ValuePredCheckBox");
04839 ivjValuePredCheckBox.setFont(new java.awt.Font("dialog.plain", 0, 12));
04840 ivjValuePredCheckBox.setText("pred");
04841 ivjValuePredCheckBox.setBackground(new java.awt.Color(204,204,255));
04842
04843
04844 } catch (java.lang.Throwable ivjExc) {
04845
04846
04847 handleException(ivjExc);
04848 }
04849 }
04850 return ivjValuePredCheckBox;
04851 }
04852
04853
04854
04855
04856
04857 private javax.swing.JCheckBox getValueSetCheckBox() {
04858 if (ivjValueSetCheckBox == null) {
04859 try {
04860 ivjValueSetCheckBox = new javax.swing.JCheckBox();
04861 ivjValueSetCheckBox.setName("ValueSetCheckBox");
04862 ivjValueSetCheckBox.setFont(new java.awt.Font("dialog.plain", 0, 12));
04863 ivjValueSetCheckBox.setText("set");
04864 ivjValueSetCheckBox.setBackground(new java.awt.Color(204,204,255));
04865
04866
04867 } catch (java.lang.Throwable ivjExc) {
04868
04869
04870 handleException(ivjExc);
04871 }
04872 }
04873 return ivjValueSetCheckBox;
04874 }
04875 private Hashtable getValueSuccAnnotationsFor(Annotation mda, Annotation stmtAnnotation) {
04876 Hashtable valueSuccAnnotations = new Hashtable();
04877 SootMethod sootMethod = null;
04878 if (mda instanceof MethodDeclarationAnnotation)
04879 sootMethod = ((MethodDeclarationAnnotation) mda).getSootMethod();
04880 else
04881 if (mda instanceof ConstructorDeclarationAnnotation)
04882 sootMethod = ((ConstructorDeclarationAnnotation) mda).getSootMethod();
04883 Map sootMap = Slicer.sootMethodInfoMap;
04884 MethodInfo methodInfo = (MethodInfo) sootMap.get(sootMethod);
04885 BuildPDG methodPDG = methodInfo.methodPDG;
04886 Stmt stmtsInAnnotation[];
04887 if (stmtAnnotation instanceof SynchronizedStmtAnnotation) {
04888 stmtsInAnnotation = new Stmt[1];
04889 stmtsInAnnotation[0] = ((SynchronizedStmtAnnotation) stmtAnnotation).getEnterMonitor();
04890 } else
04891 if (stmtAnnotation instanceof ConditionalAnnotation) {
04892 stmtsInAnnotation = ((ConditionalAnnotation) stmtAnnotation).getTestStatements();
04893 } else
04894 if (stmtAnnotation instanceof ControlFlowAnnotation) {
04895 stmtsInAnnotation = ((ControlFlowAnnotation) stmtAnnotation).getTestStatements();
04896 } else
04897 stmtsInAnnotation = stmtAnnotation.getStatements();
04898
04899
04900 Set varSet = collectVarsFromStmts(stmtsInAnnotation);
04901
04902 for (Iterator valueIt = varSet.iterator(); valueIt.hasNext();) {
04903 Value value = (Value) valueIt.next();
04904 DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode(value);
04905 Collection valueSuccs = this.BOFA_Analysis.getUses(value, sootMethod);
04906
04907 Set succAnnotations = new ArraySet();
04908 for (Iterator stmtIt = valueSuccs.iterator(); stmtIt.hasNext();) {
04909 edu.ksu.cis.bandera.bofa.Analysis.StmtMethodPair succStmtMethod = (edu.ksu.cis.bandera.bofa.Analysis.StmtMethodPair) stmtIt.next();
04910 Stmt succStmt = succStmtMethod.getStmt();
04911 if (succStmt instanceof IdentityStmt) {
04912 ParameterNode paraNode = new ParameterNode(methodInfo.sootClass, mda, (IdentityStmt) succStmt);
04913 succAnnotations.add(paraNode);
04914 } else {
04915 Annotation succStmtAnnotation = null;
04916 SootMethod methodEnclosingStmt = succStmtMethod.getSootMethod();
04917 Annotation methodAnnotation = null;
04918 if (methodEnclosingStmt.equals(sootMethod))
04919 methodAnnotation = mda;
04920 else
04921 methodAnnotation = CompilationManager.getAnnotationManager().getAnnotation(methodEnclosingStmt.getDeclaringClass(), methodEnclosingStmt);
04922
04923 try {
04924 succStmtAnnotation = methodAnnotation.getContainingAnnotation(succStmt);
04925 } catch (AnnotationException ae) {
04926 System.out.println("there is an AnnotationException! And ddStmtAnnotation may be null");
04927 }
04928 if (!succStmtAnnotation.toString().equals(""))
04929
04930
04931 succAnnotations.add(succStmtAnnotation);
04932 }
04933 }
04934 valueSuccAnnotations.put(valueNode, succAnnotations);
04935 }
04936 return valueSuccAnnotations;
04937 }
04938 private DefaultMutableTreeNode getValueSuccAnns() {
04939 DefaultMutableTreeNode currentValueSuccRoot = new DefaultMutableTreeNode("Value Successors");
04940 Hashtable valueSuccAnnotationsForOneNode;
04941 Annotation mda;
04942 if (currentNode instanceof StmtTreeNode) {
04943 StmtTreeNode startTreeNode = (StmtTreeNode) currentNode;
04944 mda = startTreeNode.currentMethodDeclarationAnnotation;
04945 currentMethodDecAnn = mda;
04946 valueSuccAnnotationsForOneNode = getValueSuccAnnotationsFor(mda, startTreeNode.currentStmtAnnotation);
04947 } else
04948 if (currentNode instanceof Annotation) {
04949 mda = currentMethodDecAnn;
04950 valueSuccAnnotationsForOneNode = getValueSuccAnnotationsFor(mda, (Annotation) currentNode);
04951 } else
04952 return currentValueSuccRoot;
04953 if (valueSuccAnnotationsForOneNode.isEmpty())
04954 return currentValueSuccRoot;
04955 for (java.util.Iterator varIt = valueSuccAnnotationsForOneNode.keySet().iterator(); varIt.hasNext();) {
04956 DefaultMutableTreeNode currentVarNode = (DefaultMutableTreeNode) varIt.next();
04957 currentValueSuccRoot.add(currentVarNode);
04958 Set valueSuccAnnotations = (Set) valueSuccAnnotationsForOneNode.get(currentVarNode);
04959
04960 for (Iterator succIt = valueSuccAnnotations.iterator(); succIt.hasNext();) {
04961 Object succObject = succIt.next();
04962 if (succObject instanceof ParameterNode) {
04963 DefaultMutableTreeNode paraNode = new DefaultMutableTreeNode(succObject);
04964 if (succObject.toString().equals("JJJCTEMP$0"))
04965 paraNode = new DefaultMutableTreeNode("this");
04966 currentVarNode.add(paraNode);
04967 } else {
04968 Annotation succAnn = (Annotation) succObject;
04969 DefaultMutableTreeNode succNode = new DefaultMutableTreeNode(succAnn);
04970 currentVarNode.add(succNode);
04971 }
04972 }
04973 }
04974 return currentValueSuccRoot;
04975 }
04976
04977
04978
04979
04980
04981 private javax.swing.JCheckBox getValueSuccCheckBox() {
04982 if (ivjValueSuccCheckBox == null) {
04983 try {
04984 ivjValueSuccCheckBox = new javax.swing.JCheckBox();
04985 ivjValueSuccCheckBox.setName("ValueSuccCheckBox");
04986 ivjValueSuccCheckBox.setFont(new java.awt.Font("dialog.plain", 0, 12));
04987 ivjValueSuccCheckBox.setText("succ");
04988 ivjValueSuccCheckBox.setBackground(new java.awt.Color(204,204,255));
04989
04990
04991 } catch (java.lang.Throwable ivjExc) {
04992
04993
04994 handleException(ivjExc);
04995 }
04996 }
04997 return ivjValueSuccCheckBox;
04998 }
04999
05000
05001
05002
05003
05004
05005
05006 private DefaultMutableTreeNode getValueTreeNode(String valueKind) {
05007 int kind = valueKindsList.indexOf(valueKind);
05008 DefaultMutableTreeNode returnNode = null;
05009 switch (kind+6) {
05010 case VALUE_PRED :
05011 returnNode = getValuePredAnns();
05012 break;
05013 case VALUE_SUCC :
05014 returnNode = getValueSuccAnns();
05015 break;
05016 case VALUE_SET :
05017 returnNode = new DefaultMutableTreeNode("Value Set");
05018 calculateValueSet(returnNode);
05019 break;
05020
05021 }
05022 return returnNode;
05023 }
05024
05025
05026
05027
05028
05029 private ViewerTabbedPane getViewerTabbedPane() {
05030 if (ivjViewerTabbedPane == null) {
05031 try {
05032 ivjViewerTabbedPane = new edu.ksu.cis.bandera.pdgslicer.dependency.ViewerTabbedPane();
05033 ivjViewerTabbedPane.setName("ViewerTabbedPane");
05034
05035 criterionViewer = ivjViewerTabbedPane.getCriterionViewer();
05036 criterionViewer.setDependFrame(this);
05037 queryPanel = ivjViewerTabbedPane.getQueryPanel();
05038 queryPanel.setDependFrame(this);
05039
05040
05041 } catch (java.lang.Throwable ivjExc) {
05042
05043
05044 handleException(ivjExc);
05045 }
05046 }
05047 return ivjViewerTabbedPane;
05048 }
05049
05050
05051
05052
05053 private void handleException(java.lang.Throwable exception) {
05054
05055
05056
05057
05058 }
05059
05060
05061
05062 public void historyComboBox_ActionEvents() {
05063 Object selectedNode = getHistoryComboBox().getSelectedItem();
05064 if (selectedNode.equals(currentNode))
05065 return;
05066 Configuration config = getCurrentConfig();
05067 nodeToConfigTable.put(currentNode, config);
05068 compactHistoryChain(currentNode);
05069 historyChain.addLast(currentNode);
05070 currentPositionOfHistoryChain++;
05071 if (!getBackToolBarButton().isEnabled())
05072 getBackToolBarButton().setEnabled(true);
05073 currentNode = selectedNode;
05074 config = (Configuration) nodeToConfigTable.get(selectedNode);
05075 restoreConfig(config);
05076 return;
05077 }
05078
05079
05080
05081
05082
05083 int historyComboBoxItemsContains(Object obj) {
05084 for (int i = 0; i < getHistoryComboBox().getItemCount(); i++) {
05085 Object item = getHistoryComboBox().getItemAt(i);
05086 if (item.equals(obj))
05087 return i;
05088 }
05089 return -1;
05090 }
05091
05092
05093
05094
05095
05096 private void initConnections() throws java.lang.Exception {
05097
05098
05099 this.addWindowListener(ivjEventHandler);
05100 getHistoryComboBox().addActionListener(ivjEventHandler);
05101 getBackToolBarButton().addActionListener(ivjEventHandler);
05102 getForwardToolBarButton().addActionListener(ivjEventHandler);
05103 getClearToolBarButton().addActionListener(ivjEventHandler);
05104 getDataPredCheckBox().addItemListener(ivjEventHandler);
05105 getDataSuccCheckBox().addItemListener(ivjEventHandler);
05106 getControlPredCheckBox().addItemListener(ivjEventHandler);
05107 getControlSuccCheckBox().addItemListener(ivjEventHandler);
05108 getDiverPredCheckBox().addItemListener(ivjEventHandler);
05109 getDiverSuccCheckBox().addItemListener(ivjEventHandler);
05110 getReadyPredCheckBox().addItemListener(ivjEventHandler);
05111 getReadySuccCheckBox().addItemListener(ivjEventHandler);
05112 getInterferPredCheckBox().addItemListener(ivjEventHandler);
05113 getInterferSuccCheckBox().addItemListener(ivjEventHandler);
05114 getSynchPredCheckBox().addItemListener(ivjEventHandler);
05115 getSynchSuccCheckBox().addItemListener(ivjEventHandler);
05116 getValuePredCheckBox().addItemListener(ivjEventHandler);
05117 getValueSuccCheckBox().addItemListener(ivjEventHandler);
05118 getValueSetCheckBox().addItemListener(ivjEventHandler);
05119 getAllpredButton().addActionListener(ivjEventHandler);
05120 getAllsuccButton().addActionListener(ivjEventHandler);
05121 getAllDependButton().addActionListener(ivjEventHandler);
05122 getNopredButton().addActionListener(ivjEventHandler);
05123 getNosuccButton().addActionListener(ivjEventHandler);
05124 getClearDependButton().addActionListener(ivjEventHandler);
05125 getAllValuesButton().addActionListener(ivjEventHandler);
05126 getClearValuesButton().addActionListener(ivjEventHandler);
05127 getBackwardSliceToolBarButton().addActionListener(ivjEventHandler);
05128 }
05129
05130
05131
05132
05133 private void initialize() {
05134 try {
05135
05136
05137
05138
05139
05140
05141
05142
05143
05144
05145 dependFrame = this;
05146
05147
05148 setName("Dependencies");
05149 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
05150 setSize(612, 702);
05151 setTitle("Dependency and Value Flow Browser");
05152 setContentPane(getDependencyFrameContentPane());
05153 initConnections();
05154 } catch (java.lang.Throwable ivjExc) {
05155 handleException(ivjExc);
05156 }
05157
05158
05159 dependencyKindsList = new ca.mcgill.sable.util.ArrayList();
05160 for (int i = 0; i < dependencyKinds.length; i++) {
05161 dependencyKindsList.add(i, dependencyKinds[i]);
05162 }
05163 valueKindsList = new ca.mcgill.sable.util.ArrayList();
05164 for (int i = 0; i < valueKinds.length; i++) {
05165 valueKindsList.add(i, valueKinds[i]);
05166 }
05167 dependencyValueViewer = new DependencyValueViewer();
05168 dependencyValueViewer.setDependFrame(this);
05169 dependencyValueViewer.setToEmptyState();
05170 if (!reRunJJJC())
05171 return;
05172 Vector criterion = criterionViewer.getSliceInterests();
05173 if (criterion == null)
05174 return;
05175
05176 criterionViewer.showCriterionInViewer(criterion);
05177 if (!runBuildingPDG())
05178 return;
05179 getCodeBrowserPane().unreachableSootClasses = edu.ksu.cis.bandera.pdgslicer.Slicer.unreachableClasses;
05180 getCodeBrowserPane().reachableSootMethods = edu.ksu.cis.bandera.pdgslicer.Slicer.reachableMethods;
05181 getCodeBrowserPane().updateHierTree(null);
05182
05183
05184
05185 BOFA_Analysis = Slicer.BOFA_Analysis;
05186
05187
05188 }
05189
05190
05191
05192
05193 private void initializeConfig() {
05194 isChangeCheckBoxByProgram = true;
05195 if (doPredDataDepend) {
05196 doPredDataDepend = false;
05197 getDataPredCheckBox().setSelected(false);
05198 }
05199 if (doPredControlDepend) {
05200 doPredControlDepend = false;
05201 getControlPredCheckBox().setSelected(false);
05202 }
05203 if (doPredReadyDepend) {
05204 doPredReadyDepend = false;
05205 getReadyPredCheckBox().setSelected(false);
05206 }
05207 if (doPredSynchDepend) {
05208 doPredSynchDepend = false;
05209 getSynchPredCheckBox().setSelected(false);
05210 }
05211 if (doPredInterferDepend) {
05212 doPredInterferDepend = false;
05213 getInterferPredCheckBox().setSelected(false);
05214 }
05215 if (doPredDivergentDepend) {
05216 doPredDivergentDepend = false;
05217 getDiverPredCheckBox().setSelected(false);
05218 }
05219 if (doSuccDataDepend) {
05220 doSuccDataDepend = false;
05221 getDataSuccCheckBox().setSelected(false);
05222 }
05223 if (doSuccControlDepend) {
05224 doSuccControlDepend = false;
05225 getControlSuccCheckBox().setSelected(false);
05226 }
05227 if (doSuccReadyDepend) {
05228 doSuccReadyDepend = false;
05229 getReadySuccCheckBox().setSelected(false);
05230 }
05231 if (doSuccSynchDepend) {
05232 doSuccSynchDepend = false;
05233 getSynchSuccCheckBox().setSelected(false);
05234 }
05235 if (doSuccInterferDepend) {
05236 doSuccInterferDepend = false;
05237 getInterferSuccCheckBox().setSelected(false);
05238 }
05239 if (doSuccDivergentDepend) {
05240 doSuccDivergentDepend = false;
05241 getDiverSuccCheckBox().setSelected(false);
05242 }
05243 if (doPredValue) {
05244 doPredValue = false;
05245 getValuePredCheckBox().setSelected(false);
05246 }
05247 if (doSuccValue) {
05248 doSuccValue = false;
05249 getValueSuccCheckBox().setSelected(false);
05250 }
05251 if (doSetValue) {
05252 doSetValue = false;
05253 getValueSetCheckBox().setSelected(false);
05254 }
05255 isChangeCheckBoxByProgram = false;
05256
05257 dependencyValueViewer.currentDependTreeRoot = new DefaultMutableTreeNode(currentNode);
05258 dependencyValueViewer.getDependencyTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentDependTreeRoot));
05259 dependencyValueViewer.currentValueTreeRoot = new DefaultMutableTreeNode(currentNode);
05260 dependencyValueViewer.getValueTree().setModel(new DefaultTreeModel(dependencyValueViewer.currentValueTreeRoot));
05261 dependencyValueViewer.changeViewerState();
05262 }
05263 private boolean interferOnListContains(List interferOnList, Set stmts) {
05264 for (Iterator interferIt = interferOnList.iterator(); interferIt.hasNext();) {
05265 InterferStmt interferStmt = (InterferStmt) interferIt.next();
05266 if (stmts.contains(interferStmt.interferStmt))
05267 return true;
05268 }
05269 return false;
05270 }
05271
05272
05273
05274 public void interferPredCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
05275 if (currentNode == null) {
05276 selectStatementWarning(getInterferPredCheckBox());
05277 return;
05278 }
05279 dependencyValueViewer.setState(Frame.NORMAL);
05280 dependencyValueViewer.toFront();
05281 doPredInterferDepend = !doPredInterferDepend;
05282 if (!doPredInterferDepend) {
05283 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05284
05285
05286 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05287 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05288 if (oneChild.toString().equals("Interference Dependence")) {
05289 if (oneChild.getChildCount() == 1) {
05290 treeModel.removeNodeFromParent(oneChild);
05291 break;
05292 } else {
05293 for (int j = 0; j < oneChild.getChildCount(); j++) {
05294 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
05295 if (predSuccChild.toString().equals("Predecessors")) {
05296 treeModel.removeNodeFromParent(predSuccChild);
05297 break;
05298 }
05299 }
05300 }
05301 break;
05302 }
05303 }
05304 } else {
05305 boolean isDependency = true;
05306 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05307 DefaultMutableTreeNode currentInterferRoot = null;
05308 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05309 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05310 if (oneChild.toString().equals("Interference Dependence")) {
05311 currentInterferRoot = oneChild;
05312 break;
05313 }
05314 }
05315 if (currentInterferRoot == null) {
05316 currentInterferRoot = new DefaultMutableTreeNode("Interference Dependence");
05317 int insertIndex = dependencyValueViewer.getInsertIndexOf("Interference Dependence", isDependency);
05318 treeModel.insertNodeInto(currentInterferRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
05319 }
05320 DefaultMutableTreeNode interferPredTreeNode = getInterferDependAnns(true);
05321 if (interferPredTreeNode != null) {
05322
05323 treeModel.insertNodeInto(interferPredTreeNode, currentInterferRoot, 0);
05324
05325 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(interferPredTreeNode.getPath()));
05326
05327
05328
05329
05330 dependencyValueViewer.expandAndCollapseFrom(interferPredTreeNode, isDependency);
05331 }
05332 }
05333
05334 dependencyValueViewer.changeViewerState();
05335 return;
05336 }
05337
05338
05339
05340 public void interferSuccCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
05341 if (currentNode == null) {
05342 selectStatementWarning(getInterferSuccCheckBox());
05343 return;
05344 }
05345 dependencyValueViewer.setState(Frame.NORMAL);
05346 dependencyValueViewer.toFront();
05347 doSuccInterferDepend = !doSuccInterferDepend;
05348 if (!doSuccInterferDepend) {
05349 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05350
05351
05352 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05353 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05354 if (oneChild.toString().equals("Interference Dependence")) {
05355 if (oneChild.getChildCount() == 1) {
05356 treeModel.removeNodeFromParent(oneChild);
05357 break;
05358 } else {
05359 for (int j = 0; j < oneChild.getChildCount(); j++) {
05360 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
05361 if (predSuccChild.toString().equals("Successors")) {
05362 treeModel.removeNodeFromParent(predSuccChild);
05363 break;
05364 }
05365 }
05366 }
05367 break;
05368 }
05369 }
05370 } else {
05371 boolean isDependency = true;
05372 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05373 DefaultMutableTreeNode currentInterferRoot = null;
05374 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05375 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05376 if (oneChild.toString().equals("Interference Dependence")) {
05377 currentInterferRoot = oneChild;
05378 break;
05379 }
05380 }
05381 if (currentInterferRoot == null) {
05382 currentInterferRoot = new DefaultMutableTreeNode("Interference Dependence");
05383 int insertIndex = dependencyValueViewer.getInsertIndexOf("Interference Dependence", isDependency);
05384 treeModel.insertNodeInto(currentInterferRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
05385 }
05386 DefaultMutableTreeNode interferSuccTreeNode = getInterferDependAnns(false);
05387 if (interferSuccTreeNode != null) {
05388
05389 treeModel.insertNodeInto(interferSuccTreeNode, currentInterferRoot, currentInterferRoot.getChildCount());
05390
05391 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(interferSuccTreeNode.getPath()));
05392
05393
05394
05395
05396 dependencyValueViewer.expandAndCollapseFrom(interferSuccTreeNode, isDependency);
05397 }
05398 }
05399
05400
05401 dependencyValueViewer.changeViewerState();
05402 return;
05403 }
05404
05405
05406
05407
05408
05409 public void itemStateChanged(java.awt.event.ItemEvent e) {
05410
05411
05412 if (e.getSource() == getDataPredCheckBox())
05413 connEtoC8(e);
05414 if (e.getSource() == getDataSuccCheckBox())
05415 connEtoC12(e);
05416 if (e.getSource() == getControlPredCheckBox())
05417 connEtoC13(e);
05418 if (e.getSource() == getControlSuccCheckBox())
05419 connEtoC16(e);
05420 if (e.getSource() == getDiverPredCheckBox())
05421 connEtoC17(e);
05422 if (e.getSource() == getDiverSuccCheckBox())
05423 connEtoC18(e);
05424 if (e.getSource() == getReadyPredCheckBox())
05425 connEtoC19(e);
05426 if (e.getSource() == getReadySuccCheckBox())
05427 connEtoC20(e);
05428 if (e.getSource() == getInterferPredCheckBox())
05429 connEtoC21(e);
05430 if (e.getSource() == getInterferSuccCheckBox())
05431 connEtoC22(e);
05432 if (e.getSource() == getSynchPredCheckBox())
05433 connEtoC23(e);
05434 if (e.getSource() == getSynchSuccCheckBox())
05435 connEtoC24(e);
05436 if (e.getSource() == getValuePredCheckBox())
05437 connEtoC25(e);
05438 if (e.getSource() == getValueSuccCheckBox())
05439 connEtoC26(e);
05440 if (e.getSource() == getValueSetCheckBox())
05441 connEtoC27(e);
05442
05443
05444 }
05445
05446
05447
05448 public void jimpleCodeForAnnotation(Annotation ann) {
05449 Stmt[] stmts = ann.getStatements();
05450 getViewerTabbedPane().getJimpleViewer().getJimpleTitleLabel().setText("Jimple code for " + ann.toString());
05451 StringBuffer str = new StringBuffer(1024);
05452 for (int i = 0; i < stmts.length; i++) {
05453 str.append(stmts[i].toString() + "\n");
05454 }
05455 getViewerTabbedPane().getJimpleViewer().getJimpleTextArea().setText(str.toString());
05456 getViewerTabbedPane().getJimpleViewer().getJimpleTextScrollPane().validate();
05457 getViewerTabbedPane().getJimpleViewer().getJimpleTextScrollPane().repaint();
05458
05459 return;
05460 }
05461
05462
05463
05464 public void jimpleCodeForSootClass(SootClass sc) {
05465 Writer str = new StringWriter(1024);
05466 PrintWriter printWriter = new PrintWriter(str, true);
05467 sc.printTo(new StoredBody(Jimple.v()), printWriter);
05468 getViewerTabbedPane().getJimpleViewer().getJimpleTitleLabel().setText("Jimple code for " + sc);
05469 getViewerTabbedPane().getJimpleViewer().getJimpleTextArea().setText(str.toString());
05470 getViewerTabbedPane().getJimpleViewer().getJimpleTextScrollPane().validate();
05471 getViewerTabbedPane().getJimpleViewer().getJimpleTextScrollPane().repaint();
05472 return;
05473 }
05474
05475
05476
05477 public void jimpleCodeForSootMethod(SootMethod sm) {
05478 Writer str = new StringWriter(1024);
05479 PrintWriter printWriter = new PrintWriter(str, true);
05480 JimpleBody jimpleBody = (JimpleBody) sm.getBody(Jimple.v());
05481 jimpleBody.printTo(printWriter, 0);
05482 getViewerTabbedPane().getJimpleViewer().getJimpleTitleLabel().setText("Jimple code for " + sm);
05483 getViewerTabbedPane().getJimpleViewer().getJimpleTextArea().setText(str.toString());
05484 getViewerTabbedPane().getJimpleViewer().getJimpleTextScrollPane().validate();
05485 getViewerTabbedPane().getJimpleViewer().getJimpleTextScrollPane().repaint();
05486 return;
05487 }
05488
05489
05490
05491
05492 public static void main(java.lang.String[] args) {
05493 try {
05494 Dependencies aDependencies;
05495 aDependencies = new Dependencies();
05496 aDependencies.addWindowListener(new java.awt.event.WindowAdapter() {
05497 public void windowClosing(java.awt.event.WindowEvent e) {
05498 System.exit(0);
05499 };
05500 });
05501 aDependencies.setVisible(true);
05502
05503 } catch (Throwable exception) {
05504 System.err.println("Exception occurred in main() of javax.swing.JFrame");
05505 exception.printStackTrace(System.out);
05506 }
05507
05508
05509 }
05510
05511
05512
05513 public void nopredButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
05514 if (currentNode == null) {
05515 selectStatementWarning(getNopredButton());
05516 return;
05517 }
05518 dependencyValueViewer.setState(Frame.NORMAL);
05519 dependencyValueViewer.toFront();
05520 isChangeCheckBoxByProgram = true;
05521 if (doPredDataDepend) {
05522 doPredDataDepend = false;
05523 getDataPredCheckBox().setSelected(false);
05524 }
05525 if (doPredControlDepend) {
05526 doPredControlDepend = false;
05527 getControlPredCheckBox().setSelected(false);
05528 }
05529 if (doPredReadyDepend) {
05530 doPredReadyDepend = false;
05531 getReadyPredCheckBox().setSelected(false);
05532 }
05533 if (doPredSynchDepend) {
05534 doPredSynchDepend = false;
05535 getSynchPredCheckBox().setSelected(false);
05536 }
05537 if (doPredInterferDepend) {
05538 doPredInterferDepend = false;
05539 getInterferPredCheckBox().setSelected(false);
05540 }
05541 if (doPredDivergentDepend) {
05542 doPredDivergentDepend = false;
05543 getDiverPredCheckBox().setSelected(false);
05544 }
05545 isChangeCheckBoxByProgram = false;
05546
05547 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05548 Set removableChild = new ca.mcgill.sable.util.ArraySet();
05549 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05550 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05551 DefaultMutableTreeNode predecessor = null;
05552 boolean foundSuccessor = false;
05553 for (int j = 0; j < oneChild.getChildCount(); j++) {
05554 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
05555 if (predSuccChild.toString().equals("Successors"))
05556 foundSuccessor = true;
05557 if (predSuccChild.toString().equals("Predecessors"))
05558 predecessor = predSuccChild;
05559 }
05560 if (predecessor == null)
05561 continue;
05562 treeModel.removeNodeFromParent(predecessor);
05563 if (!foundSuccessor)
05564 removableChild.add(oneChild);
05565 }
05566 for (Iterator childIt = removableChild.iterator(); childIt.hasNext();) {
05567 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) childIt.next();
05568 treeModel.removeNodeFromParent(oneChild);
05569 }
05570 dependencyValueViewer.changeViewerState();
05571 return;
05572 }
05573
05574
05575
05576 public void nosuccButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
05577 if (currentNode == null) {
05578 selectStatementWarning(getNosuccButton());
05579 return;
05580 }
05581 dependencyValueViewer.setState(Frame.NORMAL);
05582 dependencyValueViewer.toFront();
05583 isChangeCheckBoxByProgram = true;
05584 if (doSuccDataDepend) {
05585 doSuccDataDepend = false;
05586 getDataSuccCheckBox().setSelected(false);
05587 }
05588 if (doSuccControlDepend) {
05589 doSuccControlDepend = false;
05590 getControlSuccCheckBox().setSelected(false);
05591 }
05592 if (doSuccReadyDepend) {
05593 doSuccReadyDepend = false;
05594 getReadySuccCheckBox().setSelected(false);
05595 }
05596 if (doSuccSynchDepend) {
05597 doSuccSynchDepend = false;
05598 getSynchSuccCheckBox().setSelected(false);
05599 }
05600 if (doSuccInterferDepend) {
05601 doSuccInterferDepend = false;
05602 getInterferSuccCheckBox().setSelected(false);
05603 }
05604 if (doSuccDivergentDepend) {
05605 doSuccDivergentDepend = false;
05606 getDiverSuccCheckBox().setSelected(false);
05607 }
05608 isChangeCheckBoxByProgram = false;
05609
05610 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05611 Set removableChild = new ca.mcgill.sable.util.ArraySet();
05612 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05613 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05614 DefaultMutableTreeNode successor = null;
05615 boolean foundPredecessor = false;
05616 for (int j = 0; j < oneChild.getChildCount(); j++) {
05617 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
05618 if (predSuccChild.toString().equals("Successors"))
05619 successor = predSuccChild;
05620 if (predSuccChild.toString().equals("Predecessors"))
05621 foundPredecessor = true;
05622 ;
05623 }
05624 if (successor == null)
05625 continue;
05626 treeModel.removeNodeFromParent(successor);
05627 if (!foundPredecessor)
05628 removableChild.add(oneChild);
05629 }
05630 for (Iterator childIt = removableChild.iterator(); childIt.hasNext();) {
05631 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) childIt.next();
05632 treeModel.removeNodeFromParent(oneChild);
05633 }
05634 dependencyValueViewer.changeViewerState();
05635 return;
05636 }
05637
05638
05639
05640
05641
05642
05643
05644 private boolean readyOnListContains(List readyOnList, Stmt stmt) {
05645 for (Iterator readyIt = readyOnList.iterator(); readyIt.hasNext();) {
05646 ReadyDependStmt readyDependStmt = (ReadyDependStmt) readyIt.next();
05647 if (readyDependStmt.readyOnStmt == stmt)
05648 return true;
05649 }
05650 return false;
05651 }
05652 private boolean readyOnListContains(List readyOnList, Set exitMonitors) {
05653 for (Iterator readyIt = readyOnList.iterator(); readyIt.hasNext();) {
05654 ReadyDependStmt readyDependStmt = (ReadyDependStmt) readyIt.next();
05655 if (exitMonitors.contains(readyDependStmt.readyOnStmt))
05656 return true;
05657 }
05658 return false;
05659 }
05660
05661
05662
05663 public void readyPredCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
05664 if (currentNode == null) {
05665 selectStatementWarning(getReadyPredCheckBox());
05666 return;
05667 }
05668 dependencyValueViewer.setState(Frame.NORMAL);
05669 dependencyValueViewer.toFront();
05670 doPredReadyDepend = !doPredReadyDepend;
05671 if (!doPredReadyDepend) {
05672 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05673
05674
05675 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05676 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05677 if (oneChild.toString().equals("Ready Dependence")) {
05678 if (oneChild.getChildCount() == 1) {
05679 treeModel.removeNodeFromParent(oneChild);
05680 break;
05681 } else {
05682 for (int j = 0; j < oneChild.getChildCount(); j++) {
05683 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
05684 if (predSuccChild.toString().equals("Predecessors")) {
05685 treeModel.removeNodeFromParent(predSuccChild);
05686 break;
05687 }
05688 }
05689 }
05690 break;
05691 }
05692 }
05693 } else {
05694 boolean isDependency = true;
05695 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05696 DefaultMutableTreeNode currentReadyRoot = null;
05697 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05698 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05699 if (oneChild.toString().equals("Ready Dependence")) {
05700 currentReadyRoot = oneChild;
05701 break;
05702 }
05703 }
05704 if (currentReadyRoot == null) {
05705 currentReadyRoot = new DefaultMutableTreeNode("Ready Dependence");
05706 int insertIndex = dependencyValueViewer.getInsertIndexOf("Ready Dependence", isDependency);
05707 treeModel.insertNodeInto(currentReadyRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
05708 }
05709 DefaultMutableTreeNode readyPredTreeNode = getReadyDependAnns(true);
05710 if (readyPredTreeNode != null) {
05711
05712 treeModel.insertNodeInto(readyPredTreeNode, currentReadyRoot, 0);
05713
05714 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(readyPredTreeNode.getPath()));
05715
05716
05717
05718
05719 dependencyValueViewer.expandAndCollapseFrom(readyPredTreeNode, isDependency);
05720 }
05721 }
05722
05723 dependencyValueViewer.changeViewerState();
05724 return;
05725 }
05726
05727
05728
05729 public void readySuccCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
05730 if (currentNode == null) {
05731 selectStatementWarning(getReadySuccCheckBox());
05732 return;
05733 }
05734 dependencyValueViewer.setState(Frame.NORMAL);
05735 dependencyValueViewer.toFront();
05736 doSuccReadyDepend = !doSuccReadyDepend;
05737 if (!doSuccReadyDepend) {
05738 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05739
05740
05741 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05742 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05743 if (oneChild.toString().equals("Ready Dependence")) {
05744 if (oneChild.getChildCount() == 1) {
05745 treeModel.removeNodeFromParent(oneChild);
05746 break;
05747 } else {
05748 for (int j = 0; j < oneChild.getChildCount(); j++) {
05749 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
05750 if (predSuccChild.toString().equals("Successors")) {
05751 treeModel.removeNodeFromParent(predSuccChild);
05752 break;
05753 }
05754 }
05755 }
05756 break;
05757 }
05758 }
05759 } else {
05760 boolean isDependency = true;
05761 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
05762 DefaultMutableTreeNode currentReadyRoot = null;
05763 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
05764 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
05765 if (oneChild.toString().equals("Ready Dependence")) {
05766 currentReadyRoot = oneChild;
05767 break;
05768 }
05769 }
05770 if (currentReadyRoot == null) {
05771 currentReadyRoot = new DefaultMutableTreeNode("Ready Dependence");
05772 int insertIndex = dependencyValueViewer.getInsertIndexOf("Ready Dependence", isDependency);
05773 treeModel.insertNodeInto(currentReadyRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
05774 }
05775 DefaultMutableTreeNode readySuccTreeNode = getReadyDependAnns(false);
05776 if (readySuccTreeNode != null) {
05777
05778 treeModel.insertNodeInto(readySuccTreeNode, currentReadyRoot, currentReadyRoot.getChildCount());
05779
05780 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(readySuccTreeNode.getPath()));
05781
05782
05783
05784
05785 dependencyValueViewer.expandAndCollapseFrom(readySuccTreeNode, isDependency);
05786 }
05787 }
05788
05789
05790 dependencyValueViewer.changeViewerState();
05791 return;
05792 }
05793
05794
05795
05796 boolean reRunJJJC() {
05797 try {
05798 CompilationManager.compile();
05799 if (CompilationManager.getExceptions().size() > 0) {
05800 System.out.println("exceptions in compilation manager: ");
05801 for (Enumeration eenu = CompilationManager.getExceptions().elements(); eenu.hasMoreElements();)
05802 System.out.println(eenu.nextElement());
05803 throw new Exception("Errors occured when compiling the program");
05804 }
05805 } catch (Exception e) {
05806 e.printStackTrace();
05807 JOptionPane.showMessageDialog(this, e.getMessage(), "JJJC Phase for Dependencies --- Error", JOptionPane.ERROR_MESSAGE);
05808 this.success = false;
05809 return false;
05810 }
05811 this.success = true;
05812 return true;
05813 }
05814 public void restoreConfig(Configuration config) {
05815 initializeConfig();
05816
05817 isChangeCheckBoxByProgram = true;
05818 if (config.dataPred) {
05819 doPredDataDepend = true;
05820 getDataPredCheckBox().setSelected(true);
05821 }
05822 if (config.controlPred) {
05823 doPredControlDepend = true;
05824 getControlPredCheckBox().setSelected(true);
05825 }
05826 if (config.readyPred) {
05827 doPredReadyDepend = true;
05828 getReadyPredCheckBox().setSelected(true);
05829 }
05830 if (config.synchPred) {
05831 doPredSynchDepend = true;
05832 getSynchPredCheckBox().setSelected(true);
05833 }
05834 if (config.interferPred) {
05835 doPredInterferDepend = true;
05836 getInterferPredCheckBox().setSelected(true);
05837 }
05838 if (config.divergentPred) {
05839 doPredDivergentDepend = true;
05840 getDiverPredCheckBox().setSelected(true);
05841 }
05842 if (config.dataSucc) {
05843 doSuccDataDepend = true;
05844 getDataSuccCheckBox().setSelected(true);
05845 }
05846 if (config.controlSucc) {
05847 doSuccControlDepend = true;
05848 getControlSuccCheckBox().setSelected(true);
05849 }
05850 if (config.readySucc) {
05851 doSuccReadyDepend = true;
05852 getReadySuccCheckBox().setSelected(true);
05853 }
05854 if (config.synchSucc) {
05855 doSuccSynchDepend = true;
05856 getSynchSuccCheckBox().setSelected(true);
05857 }
05858 if (config.interferSucc) {
05859 doSuccInterferDepend = true;
05860 getInterferSuccCheckBox().setSelected(true);
05861 }
05862 if (config.divergentSucc) {
05863 doSuccDivergentDepend = true;
05864 getDiverSuccCheckBox().setSelected(true);
05865 }
05866 if (config.valuePred) {
05867 doPredValue = true;
05868 getValuePredCheckBox().setSelected(true);
05869 }
05870 if (config.valueSucc) {
05871 doSuccValue = true;
05872 getValueSuccCheckBox().setSelected(true);
05873 }
05874 if (config.valueSet) {
05875 doSetValue = true;
05876 getValueSetCheckBox().setSelected(true);
05877 }
05878 isChangeCheckBoxByProgram = false;
05879
05880
05881
05882
05883 dependencyValueViewer.currentDependTreeRoot = config.currentDependTreeRoot;
05884 dependencyValueViewer.currentValueTreeRoot = config.currentValueTreeRoot;
05885 if (config.currentDependTreeRoot != null) {
05886 dependencyValueViewer.getDependencyTree().setModel(new DefaultTreeModel(config.currentDependTreeRoot));
05887 boolean isDependency = true;
05888 dependencyValueViewer.expandDependTreeToOneLevel(isDependency);
05889 }
05890 if (config.currentValueTreeRoot != null) {
05891 dependencyValueViewer.getValueTree().setModel(new DefaultTreeModel(config.currentValueTreeRoot));
05892 boolean isDependency = false;
05893 dependencyValueViewer.expandDependTreeToOneLevel(isDependency);
05894 }
05895 dependencyValueViewer.changeStateFromEmptyTo(config.dependValueViewerState);
05896 getViewerTabbedPane().setSelectedIndex(config.viewerState);
05897 queryPanel.getQueryKindComboBox().setSelectedIndex(QueryPanel.NO_QUERY);
05898 queryPanel.getQueryKindComboBox().setSelectedIndex(config.queryIndex);
05899 getCodeBrowserPane().setCurrentNodeSelected(currentNode);
05900 }
05901
05902
05903
05904
05905
05906 private void restoreConfigByAddingNewNode(Configuration config) {
05907 if (config.dataPred) {
05908 getDataPredCheckBox().setSelected(true);
05909 }
05910 if (config.controlPred) {
05911 getControlPredCheckBox().setSelected(true);
05912 }
05913 if (config.readyPred) {
05914 getReadyPredCheckBox().setSelected(true);
05915 }
05916 if (config.synchPred) {
05917 getSynchPredCheckBox().setSelected(true);
05918 }
05919 if (config.interferPred) {
05920 getInterferPredCheckBox().setSelected(true);
05921 }
05922 if (config.divergentPred) {
05923 getDiverPredCheckBox().setSelected(true);
05924 }
05925 if (config.dataSucc) {
05926 getDataSuccCheckBox().setSelected(true);
05927 }
05928 if (config.controlSucc) {
05929 getControlSuccCheckBox().setSelected(true);
05930 }
05931 if (config.readySucc) {
05932 getReadySuccCheckBox().setSelected(true);
05933 }
05934 if (config.synchSucc) {
05935 getSynchSuccCheckBox().setSelected(true);
05936 }
05937 if (config.interferSucc) {
05938 getInterferSuccCheckBox().setSelected(true);
05939 }
05940 if (config.divergentSucc) {
05941 getDiverSuccCheckBox().setSelected(true);
05942 }
05943 if (config.valuePred) {
05944 getValuePredCheckBox().setSelected(true);
05945 }
05946 if (config.valueSucc) {
05947 getValueSuccCheckBox().setSelected(true);
05948 }
05949 if (config.valueSet) {
05950 getValueSetCheckBox().setSelected(true);
05951 }
05952 queryPanel.getQueryKindComboBox().setSelectedIndex(QueryPanel.NO_QUERY);
05953 queryPanel.getQueryKindComboBox().setSelectedIndex(config.queryIndex);
05954 }
05955
05956
05957
05958
05959 boolean runBuildingPDG() {
05960 try {
05961 Hashtable compiledClasses = CompilationManager.getAnnotationManager().getAnnotationTable();
05962 SootClass[] sootClasses = new SootClass[compiledClasses.size()];
05963 int i = 0;
05964 for (Enumeration e = compiledClasses.keys(); e.hasMoreElements(); i++)
05965 sootClasses[i] = (SootClass) e.nextElement();
05966 slicer = new Slicer(sootClasses, CompilationManager.getAnnotationManager());
05967 slicer.buildPDG();
05968 } catch (Exception e) {
05969 System.out.println("exception: " + e);
05970 e.printStackTrace();
05971 JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
05972
05973 CompilationManager.setModifiedMethodTable(new Hashtable());
05974 this.success = false;
05975 return false;
05976 }
05977 this.success = true;
05978 return true;
05979 }
05980
05981
05982
05983
05984
05985 private void selectStatementWarning(AbstractButton checkBox) {
05986 JOptionPane.showMessageDialog(this, "Please choose statement first", "No statement selected", JOptionPane.WARNING_MESSAGE);
05987 isChangeCheckBoxByProgram = true;
05988 checkBox.setSelected(false);
05989 isChangeCheckBoxByProgram = false;
05990 }
05991 private Set stmtSetEffectedBy(Map interferMap, Set stmtSet) {
05992 Set effectedStmtSet = new ArraySet();
05993 for (Iterator keyIt = interferMap.keySet().iterator(); keyIt.hasNext();) {
05994 Stmt keyStmt = (Stmt) keyIt.next();
05995 List interferOnList = (List) interferMap.get(keyStmt);
05996 if (interferOnListContains(interferOnList, stmtSet))
05997 effectedStmtSet.add(keyStmt);
05998 }
05999 return effectedStmtSet;
06000 }
06001
06002
06003
06004 public void synchPredCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
06005 if (currentNode == null) {
06006 selectStatementWarning(getSynchPredCheckBox());
06007 return;
06008 }
06009 dependencyValueViewer.setState(Frame.NORMAL);
06010 dependencyValueViewer.toFront();
06011 doPredSynchDepend = !doPredSynchDepend;
06012 if (!doPredSynchDepend) {
06013 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
06014
06015
06016 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
06017 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
06018 if (oneChild.toString().equals("Synchronization Dependence")) {
06019 if (oneChild.getChildCount() == 1) {
06020 treeModel.removeNodeFromParent(oneChild);
06021 break;
06022 } else {
06023 for (int j = 0; j < oneChild.getChildCount(); j++) {
06024 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
06025 if (predSuccChild.toString().equals("Predecessors")) {
06026 treeModel.removeNodeFromParent(predSuccChild);
06027 break;
06028 }
06029 }
06030 }
06031 break;
06032 }
06033 }
06034 } else {
06035 boolean isDependency = true;
06036 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
06037 DefaultMutableTreeNode currentSynchRoot = null;
06038 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
06039 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
06040 if (oneChild.toString().equals("Synchronization Dependence")) {
06041 currentSynchRoot = oneChild;
06042 break;
06043 }
06044 }
06045 if (currentSynchRoot == null) {
06046 currentSynchRoot = new DefaultMutableTreeNode("Synchronization Dependence");
06047 int insertIndex = dependencyValueViewer.getInsertIndexOf("Synchronization Dependence", isDependency);
06048 treeModel.insertNodeInto(currentSynchRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
06049 }
06050 DefaultMutableTreeNode synchPredTreeNode = getSynchDependAnns(true);
06051 if (synchPredTreeNode != null) {
06052
06053 treeModel.insertNodeInto(synchPredTreeNode, currentSynchRoot, 0);
06054
06055 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(synchPredTreeNode.getPath()));
06056
06057
06058
06059
06060 dependencyValueViewer.expandAndCollapseFrom(synchPredTreeNode, isDependency);
06061 }
06062 }
06063
06064 dependencyValueViewer.changeViewerState();
06065 return;
06066 }
06067
06068
06069
06070 public void synchSuccCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
06071 if (currentNode == null) {
06072 selectStatementWarning(getSynchSuccCheckBox());
06073 return;
06074 }
06075 dependencyValueViewer.setState(Frame.NORMAL);
06076 dependencyValueViewer.toFront();
06077 doSuccSynchDepend = !doSuccSynchDepend;
06078 if (!doSuccSynchDepend) {
06079 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
06080
06081
06082 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
06083 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
06084 if (oneChild.toString().equals("Synchronization Dependence")) {
06085 if (oneChild.getChildCount() == 1) {
06086 treeModel.removeNodeFromParent(oneChild);
06087 break;
06088 } else {
06089 for (int j = 0; j < oneChild.getChildCount(); j++) {
06090 DefaultMutableTreeNode predSuccChild = (DefaultMutableTreeNode) oneChild.getChildAt(j);
06091 if (predSuccChild.toString().equals("Successors")) {
06092 treeModel.removeNodeFromParent(predSuccChild);
06093 break;
06094 }
06095 }
06096 }
06097 break;
06098 }
06099 }
06100 } else {
06101 boolean isDependency = true;
06102 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getDependencyTree().getModel();
06103 DefaultMutableTreeNode currentSynchRoot = null;
06104 for (int i = 0; i < dependencyValueViewer.currentDependTreeRoot.getChildCount(); i++) {
06105 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentDependTreeRoot.getChildAt(i);
06106 if (oneChild.toString().equals("Synchronization Dependence")) {
06107 currentSynchRoot = oneChild;
06108 break;
06109 }
06110 }
06111 if (currentSynchRoot == null) {
06112 currentSynchRoot = new DefaultMutableTreeNode("Synchornization Dependence");
06113 int insertIndex = dependencyValueViewer.getInsertIndexOf("Synchronization Dependence", isDependency);
06114 treeModel.insertNodeInto(currentSynchRoot, dependencyValueViewer.currentDependTreeRoot, insertIndex);
06115 }
06116 DefaultMutableTreeNode synchSuccTreeNode = getSynchDependAnns(false);
06117 if (synchSuccTreeNode != null) {
06118
06119 treeModel.insertNodeInto(synchSuccTreeNode, currentSynchRoot, currentSynchRoot.getChildCount());
06120
06121 dependencyValueViewer.getDependencyTree().scrollPathToVisible(new TreePath(synchSuccTreeNode.getPath()));
06122
06123
06124
06125
06126 dependencyValueViewer.expandAndCollapseFrom(synchSuccTreeNode, isDependency);
06127 }
06128 }
06129
06130
06131 dependencyValueViewer.changeViewerState();
06132 return;
06133 }
06134
06135
06136
06137
06138
06139
06140 Vector transformCriterion(Vector v) {
06141 SootClassManager scm = CompilationManager.getSootClassManager();
06142 for (Enumeration e = v.elements(); e.hasMoreElements();) {
06143 SliceInterest si = (SliceInterest) e.nextElement();
06144 SootClass scInV = si.getSootClass();
06145 SootClass newSc = scm.getClass(scInV.getName());
06146 si.setSootClass(newSc);
06147 if (si instanceof SliceLocal) {
06148 SliceLocal sloc = (SliceLocal) si;
06149 SootMethod sm = sloc.getSootMethod();
06150 SootMethod newSm = newSc.getMethod(sm.getName());
06151 sloc.setSootMethod(newSm);
06152 Local loc = sloc.getLocal();
06153 JimpleBody jimpleBody = (JimpleBody) newSm.getBody(Jimple.v());
06154 Local newLoc = jimpleBody.getLocal(loc.getName());
06155 sloc.setLocal(newLoc);
06156 } else
06157 if (si instanceof SlicePoint) {
06158 SlicePoint spt = (SlicePoint) si;
06159 SootMethod sm = spt.getSootMethod();
06160 SootMethod newSm = newSc.getMethod(sm.getName());
06161 spt.setSootMethod(newSm);
06162 int index = spt.getIndex();
06163 JimpleBody jimpleBody = (JimpleBody) newSm.getBody(Jimple.v());
06164 StmtList stmtList = jimpleBody.getStmtList();
06165 Stmt newStmt = (Stmt) stmtList.get(index);
06166 spt.setStmt(newStmt);
06167 } else
06168 if (si instanceof SliceField) {
06169 SliceField sfd = (SliceField) si;
06170 SootField stfd = sfd.getSootField();
06171 SootField newSf = newSc.getField(stfd.getName());
06172 sfd.setSootField(newSf);
06173 }
06174 }
06175 return v;
06176 }
06177 private boolean treePathContains(DefaultMutableTreeNode currentLeaf, Object aNode) {
06178 if (aNode instanceof StmtTreeNode) {
06179 StmtTreeNode node = (StmtTreeNode) aNode;
06180 TreeNode[] nodesInPath = currentLeaf.getPath();
06181 for (int i = 0; i < nodesInPath.length; i++) {
06182 DefaultMutableTreeNode nodeInPath = (DefaultMutableTreeNode) nodesInPath[i];
06183 Object objectInNode = nodeInPath.getUserObject();
06184 if (node.equals(objectInNode))
06185 return true;
06186 }
06187 } else
06188 if (aNode instanceof Annotation) {
06189 Annotation nodeAnnotation = (Annotation) aNode;
06190 TreeNode[] nodesInPath = currentLeaf.getPath();
06191 for (int i = 0; i < nodesInPath.length; i++) {
06192 DefaultMutableTreeNode nodeInPath = (DefaultMutableTreeNode) nodesInPath[i];
06193 Object objectInNode = nodeInPath.getUserObject();
06194 Object annotationInNode = null;
06195 if (objectInNode instanceof StmtTreeNode)
06196 annotationInNode = (Object) ((StmtTreeNode) objectInNode).currentStmtAnnotation;
06197 else
06198 annotationInNode = objectInNode;
06199 if (nodeAnnotation.equals(annotationInNode))
06200 return true;
06201 }
06202 }
06203 return false;
06204 }
06205
06206
06207
06208 public void valuePredCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
06209 if (currentNode == null) {
06210 selectStatementWarning(getValuePredCheckBox());
06211 return;
06212 }
06213 dependencyValueViewer.setState(Frame.NORMAL);
06214 dependencyValueViewer.toFront();
06215 doPredValue = !doPredValue;
06216 if (!doPredValue) {
06217
06218 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getValueTree().getModel();
06219
06220
06221 for (int i = 0; i < dependencyValueViewer.currentValueTreeRoot.getChildCount(); i++) {
06222 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentValueTreeRoot.getChildAt(i);
06223 if (oneChild.toString().equals("Value Predecessors")) {
06224 treeModel.removeNodeFromParent(oneChild);
06225 break;
06226 }
06227 }
06228 } else {
06229
06230 boolean isDependency = false;
06231 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getValueTree().getModel();
06232
06233 int insertIndex = dependencyValueViewer.getInsertIndexOf("Value Predecessors", isDependency);
06234 DefaultMutableTreeNode currentValuePredRoot = getValuePredAnns();
06235 if (currentValuePredRoot != null) {
06236
06237 treeModel.insertNodeInto(currentValuePredRoot, dependencyValueViewer.currentValueTreeRoot, insertIndex);
06238
06239 dependencyValueViewer.getValueTree().scrollPathToVisible(new TreePath(currentValuePredRoot.getPath()));
06240
06241
06242
06243
06244 dependencyValueViewer.expandAndCollapseFrom(currentValuePredRoot, isDependency);
06245 }
06246 }
06247
06248 dependencyValueViewer.changeViewerState();
06249 return;
06250 }
06251
06252
06253
06254 public void valueSetCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
06255 if (currentNode == null) {
06256 selectStatementWarning(getValueSetCheckBox());
06257 return;
06258 }
06259 dependencyValueViewer.setState(Frame.NORMAL);
06260 dependencyValueViewer.toFront();
06261 doSetValue = !doSetValue;
06262 if (doSetValue) {
06263
06264 boolean isDependency = false;
06265 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getValueTree().getModel();
06266 DefaultMutableTreeNode currentValueSetRoot = new DefaultMutableTreeNode("Value Set");
06267 int insertIndex = dependencyValueViewer.getInsertIndexOf("Value Set", isDependency);
06268 treeModel.insertNodeInto(currentValueSetRoot, dependencyValueViewer.currentValueTreeRoot, insertIndex);
06269 calculateValueSet(currentValueSetRoot);
06270 dependencyValueViewer.getValueTree().scrollPathToVisible(new TreePath(currentValueSetRoot.getPath()));
06271 dependencyValueViewer.expandAndCollapseFrom(currentValueSetRoot, isDependency);
06272 } else {
06273 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getValueTree().getModel();
06274 for (int i = 0; i < dependencyValueViewer.currentValueTreeRoot.getChildCount(); i++) {
06275 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentValueTreeRoot.getChildAt(i);
06276 if (oneChild.toString().equals("Value Set")) {
06277 treeModel.removeNodeFromParent(oneChild);
06278 break;
06279 }
06280 }
06281 }
06282
06283 dependencyValueViewer.changeViewerState();
06284 return;
06285 }
06286
06287
06288
06289 public void valueSuccCheckBox_ItemStateChanged(java.awt.event.ItemEvent itemEvent) {
06290 if (currentNode == null) {
06291 selectStatementWarning(getValueSuccCheckBox());
06292 return;
06293 }
06294 dependencyValueViewer.setState(Frame.NORMAL);
06295 dependencyValueViewer.toFront();
06296 doSuccValue = !doSuccValue;
06297 if (!doSuccValue) {
06298
06299 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getValueTree().getModel();
06300
06301
06302 for (int i = 0; i < dependencyValueViewer.currentValueTreeRoot.getChildCount(); i++) {
06303 DefaultMutableTreeNode oneChild = (DefaultMutableTreeNode) dependencyValueViewer.currentValueTreeRoot.getChildAt(i);
06304 if (oneChild.toString().equals("Value Successors")) {
06305 treeModel.removeNodeFromParent(oneChild);
06306 break;
06307 }
06308 }
06309 } else {
06310
06311 boolean isDependency = false;
06312 DefaultTreeModel treeModel = (DefaultTreeModel) dependencyValueViewer.getValueTree().getModel();
06313
06314 int insertIndex = dependencyValueViewer.getInsertIndexOf("Value Successors", isDependency);
06315 DefaultMutableTreeNode currentValueSuccRoot = getValueSuccAnns();
06316 if (currentValueSuccRoot != null) {
06317
06318 treeModel.insertNodeInto(currentValueSuccRoot, dependencyValueViewer.currentValueTreeRoot, insertIndex);
06319
06320 dependencyValueViewer.getValueTree().scrollPathToVisible(new TreePath(currentValueSuccRoot.getPath()));
06321
06322
06323
06324
06325 dependencyValueViewer.expandAndCollapseFrom(currentValueSuccRoot, isDependency);
06326 }
06327 }
06328
06329 dependencyValueViewer.changeViewerState();
06330 return;
06331 }
06332
06333
06334
06335
06336
06337
06338
06339 private Set waitSetEffectedBy(MethodInfo methodInfo, SynchroStmt notifyStmt) {
06340 Set waitSet = new ArraySet();
06341 BuildPDG methodPDG = methodInfo.methodPDG;
06342 Map readyDependMap = methodPDG.getReadyDependMap();
06343 if (readyDependMap == null)
06344 return waitSet;
06345 Stmt notifyJimpleStmt = notifyStmt.getWaitNotify();
06346 for (Iterator keyIt = readyDependMap.keySet().iterator(); keyIt.hasNext();) {
06347 Stmt keyStmt = (Stmt) keyIt.next();
06348 List readyOnList = (List) readyDependMap.get(keyStmt);
06349 if (readyOnListContains(readyOnList, notifyJimpleStmt))
06350 waitSet.add(keyStmt);
06351 }
06352 return waitSet;
06353 }
06354
06355
06356
06357
06358
06359 public void windowActivated(java.awt.event.WindowEvent e) {
06360
06361
06362
06363
06364 }
06365
06366
06367
06368
06369
06370 public void windowClosed(java.awt.event.WindowEvent e) {
06371
06372
06373 if (e.getSource() == this)
06374 connEtoC1(e);
06375
06376
06377 }
06378
06379
06380
06381
06382
06383 public void windowClosing(java.awt.event.WindowEvent e) {
06384
06385
06386
06387
06388 }
06389
06390
06391
06392
06393
06394 public void windowDeactivated(java.awt.event.WindowEvent e) {
06395
06396
06397
06398
06399 }
06400
06401
06402
06403
06404
06405 public void windowDeiconified(java.awt.event.WindowEvent e) {
06406
06407
06408
06409
06410 }
06411
06412
06413
06414
06415
06416 public void windowIconified(java.awt.event.WindowEvent e) {
06417
06418
06419
06420
06421 }
06422
06423
06424
06425
06426
06427 public void windowOpened(java.awt.event.WindowEvent e) {
06428
06429
06430
06431
06432 }
06433 }