gr.uom.java.xmi.diff.CallTree Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of refactoring-miner Show documentation
Show all versions of refactoring-miner Show documentation
RefactoringMiner is a library/API written in Java that can detect refactorings applied in the history of a Java project.
package gr.uom.java.xmi.diff;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import gr.uom.java.xmi.UMLOperation;
public class CallTree {
private CallTreeNode root;
public CallTree(CallTreeNode root) {
this.root = root;
}
public List getNodesInBreadthFirstOrder() {
List nodes = new ArrayList();
List queue = new LinkedList();
nodes.add(root);
queue.add(root);
while(!queue.isEmpty()) {
CallTreeNode node = queue.remove(0);
nodes.addAll(node.getChildren());
queue.addAll(node.getChildren());
}
return nodes;
}
public boolean contains(UMLOperation invokedOperation) {
for(CallTreeNode node : getNodesInBreadthFirstOrder()) {
if(node.getInvokedOperation().equals(invokedOperation)) {
return true;
}
}
return false;
}
}