Graph API change: Graph is now an Iterable of Nodes!

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@869 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2007-03-21 21:07:42 +00:00
parent e955c1e657
commit 893418ca3c
6 changed files with 17 additions and 17 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.swtLaunchConfig">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.SWTCallGraph"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/testdata/java_cup.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/javac.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -verbose:gc"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -verbose:gc"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>

View File

@ -442,7 +442,7 @@ public class CallGraphTest extends WalaTestCase {
// perform a little icfg exercise
int count = 0;
for (Iterator<? extends BasicBlockInContext> it = icfg.iterateNodes(); it.hasNext();) {
for (Iterator<? extends BasicBlockInContext> it = icfg.iterator(); it.hasNext();) {
IBasicBlock bb = (IBasicBlock) it.next();
if (icfg.hasCall((BasicBlockInContext) bb)) {
count++;
@ -476,8 +476,8 @@ public class CallGraphTest extends WalaTestCase {
* @param subG
*/
public static void checkGraphSubset(ECallGraphWrapper superG, ECallGraphWrapper subG) {
Set<EObject> nodeDiff = Util.setify(subG.iterateNodes());
nodeDiff.removeAll(Util.setify(superG.iterateNodes()));
Set<EObject> nodeDiff = Util.setify(subG.iterator());
nodeDiff.removeAll(Util.setify(superG.iterator()));
Set<EObject> toRemove = HashSetFactory.make();
for (Iterator<EObject> it = nodeDiff.iterator(); it.hasNext();) {
EObject o = it.next();
@ -543,7 +543,7 @@ public class CallGraphTest extends WalaTestCase {
// remove other nodes
toRemove = HashSetFactory.make();
for (Iterator<? extends EObject> it = G.iterateNodes(); it.hasNext();) {
for (Iterator<? extends EObject> it = G.iterator(); it.hasNext();) {
EObject n = it.next();
if (!c.contains(n)) {
toRemove.add(n);
@ -553,7 +553,7 @@ public class CallGraphTest extends WalaTestCase {
// remove call site nodes with no targets (these won't appear in the dcg)
toRemove = HashSetFactory.make();
for (Iterator<? extends EObject> it = G.iterateNodes(); it.hasNext();) {
for (Iterator<? extends EObject> it = G.iterator(); it.hasNext();) {
EObject n = it.next();
if (n instanceof ECallSite) {
if (G.getSuccNodeCount(n) == 0) {
@ -585,7 +585,7 @@ public class CallGraphTest extends WalaTestCase {
*/
private static Set<CGNode> getSyntheticLeaves(CallGraph cg) {
HashSet<CGNode> result = HashSetFactory.make();
for (Iterator<? extends CGNode> it = cg.iterateNodes(); it.hasNext();) {
for (Iterator<? extends CGNode> it = cg.iterator(); it.hasNext();) {
CGNode node = (CGNode) it.next();
if (!node.equals(cg.getFakeRootNode())) {
if (node.getMethod().isSynthetic()) {

View File

@ -85,7 +85,7 @@ public class CompareCDGTest extends WalaTestCase {
long cdgTime = 0;
long bvTime = 0;
String dotExe = "dot";
for (Iterator<? extends CGNode> it = g.iterateNodes(); it.hasNext();) {
for (Iterator<? extends CGNode> it = g.iterator(); it.hasNext();) {
CGNode n = (CGNode) it.next();
MethodReference mref = n.getMethod().getReference();
Trace.println(mref.toString());
@ -143,7 +143,7 @@ public class CompareCDGTest extends WalaTestCase {
private static boolean compatible(SSACFG cfg, ControlDependenceGraph cdg, BVControlDependenceGraph bv) {
boolean ret = true;
for (Iterator<? extends IBasicBlock> it = cfg.iterateNodes(); it.hasNext();) {
for (Iterator<? extends IBasicBlock> it = cfg.iterator(); it.hasNext();) {
SSACFG.BasicBlock ibb = (SSACFG.BasicBlock) it.next();
int cCount = cdg.getPredNodeCount(ibb);
int bCount = bv.getPredNodeCount(ibb);
@ -338,7 +338,7 @@ public class CompareCDGTest extends WalaTestCase {
*/
private static Vector<BasicBlock> checkCFG(SSACFG cfg, MethodReference mref) {
Vector<SSACFG.BasicBlock> vec = new Vector<SSACFG.BasicBlock>();
for (Iterator<? extends IBasicBlock> it = cfg.iterateNodes(); it.hasNext();) {
for (Iterator<? extends IBasicBlock> it = cfg.iterator(); it.hasNext();) {
SSACFG.BasicBlock bb = (SSACFG.BasicBlock) it.next();
if (cfg.getPredNodeCount(bb) == 0)
vec.add(bb);

View File

@ -76,7 +76,7 @@ public class MultiDimArrayTest extends WalaTestCase {
}
private final static CGNode findDoNothingNode(CallGraph cg) {
for (Iterator<? extends CGNode> it = cg.iterateNodes(); it.hasNext(); ) {
for (Iterator<? extends CGNode> it = cg.iterator(); it.hasNext(); ) {
CGNode n = it.next();
if (n.getMethod().getName().toString().equals("doNothing")) {
return n;

View File

@ -509,7 +509,7 @@ public class SlicerTest extends TestCase {
public static CGNode findMethod(CallGraph cg, String name) {
Atom a = Atom.findOrCreateUnicodeAtom(name);
for (Iterator<? extends CGNode> it = cg.iterateNodes(); it.hasNext();) {
for (Iterator<? extends CGNode> it = cg.iterator(); it.hasNext();) {
CGNode n = it.next();
if (n.getMethod().getName().equals(a)) {
return n;

View File

@ -102,13 +102,13 @@ public class GVTypeHierarchy {
public static Graph<EObject> typeHierarchy2Graph(ETypeHierarchy et) throws WalaException {
ETypeHierarchyWrapper t = new ETypeHierarchyWrapper(et);
EObjectGraphImpl dg = new EObjectGraphImpl();
for (Iterator<? extends EObject> it = t.getClasses().iterateNodes(); it.hasNext();) {
for (Iterator<? extends EObject> it = t.getClasses().iterator(); it.hasNext();) {
dg.addNode(it.next());
}
for (Iterator<? extends EObject> it = t.getInterfaces().iterateNodes(); it.hasNext();) {
for (Iterator<? extends EObject> it = t.getInterfaces().iterator(); it.hasNext();) {
dg.addNode(it.next());
}
for (Iterator<? extends EObject> it = t.getClasses().iterateNodes(); it.hasNext();) {
for (Iterator<? extends EObject> it = t.getClasses().iterator(); it.hasNext();) {
EJavaClass x = (EJavaClass) it.next();
for (Iterator<? extends EObject> it2 = t.getClasses().getSuccNodes(x); it2.hasNext();) {
dg.addEdge(x, it2.next());
@ -117,7 +117,7 @@ public class GVTypeHierarchy {
dg.addEdge(it2.next(), x);
}
}
for (Iterator<? extends EObject> it = t.getInterfaces().iterateNodes(); it.hasNext();) {
for (Iterator<? extends EObject> it = t.getInterfaces().iterator(); it.hasNext();) {
EJavaClass x = (EJavaClass) it.next();
for (Iterator<? extends EObject> it2 = t.getInterfaces().getSuccNodes(x); it2.hasNext();) {
dg.addEdge(x, it2.next());