Skip to content

Commit 05bf41a

Browse files
#103 change iterator
1 parent ab87978 commit 05bf41a

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/Stream.java

-18
Original file line numberDiff line numberDiff line change
@@ -643,24 +643,6 @@ protected CGNode getEnclosingMethodNode() throws IOException, CoreException, NoE
643643
else
644644
return nodes.iterator().next(); // just return the first.
645645
}
646-
647-
/**
648-
* add all CGNodes in call graph to a hash set
649-
* @return a hash set of CGNode
650-
* @throws IOException
651-
* @throws CoreException
652-
* @throws NoEnclosingMethodNodeFoundException
653-
*/
654-
protected HashSet<CGNode> getCGNodesInGraph() throws IOException, CoreException {
655-
HashSet<CGNode> cgNodes = new HashSet<>();
656-
657-
Iterator<CGNode> cgNodeIterator = this.getAnalysisEngine().getCallGraph().iterator();
658-
for (; cgNodeIterator.hasNext();) {
659-
cgNodes.add(cgNodeIterator.next());
660-
}
661-
662-
return cgNodes;
663-
}
664646

665647
/**
666648
* Returns true iff all of the predecessors of all of the given {@link CGNode}s

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/StreamStateMachine.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ public void start() throws IOException, CoreException, CallGraphBuilderCancelExc
280280
// the node of where the stream was declared: TODO: Can this be
281281
// somehow rewritten to get blocks corresponding to terminal
282282
// operations?
283-
for (CGNode cgNode : this.getStream().getCGNodesInGraph()) {
283+
Iterator<CGNode> cgNodes = this.getStream().getAnalysisEngine().getCallGraph().iterator();
284+
for (;cgNodes.hasNext();) {
285+
CGNode cgNode = cgNodes.next();
284286
for (Iterator<CallSiteReference> callSites = cgNode.iterateCallSites(); callSites.hasNext();) {
285287
CallSiteReference callSiteReference = callSites.next();
286288
MethodReference calledMethod = callSiteReference.getDeclaredTarget();

0 commit comments

Comments
 (0)