// returns the unique predecessor if there is one; // throws an exception otherwise public CfgNode getPredecessor() { List<CfgNode> predecessors = this.getPredecessors(); if (predecessors.size() != 1) { throw new RuntimeException("SNH: " + predecessors.size()); } return predecessors.get(0); }
public List<CfgNode> getPredecessors() { List<CfgNode> predecessors = new LinkedList<CfgNode>(); for (Iterator iter = this.inEdges.iterator(); iter.hasNext(); ) { CfgEdge inEdge = (CfgEdge) iter.next(); predecessors.add(inEdge.getSource()); } return predecessors; }
public List<CfgNode> getSuccessors() { List<CfgNode> successors = new LinkedList<CfgNode>(); if (this.outEdges[0] != null) { successors.add(this.outEdges[0].getDest()); if (this.outEdges[1] != null) { successors.add(this.outEdges[1].getDest()); } } return successors; }