diff --git a/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/BellmanFord.java b/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/BellmanFord.java old mode 100644 new mode 100755 diff --git a/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/BreadthFirstSearch.java b/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/BreadthFirstSearch.java old mode 100644 new mode 100755 diff --git a/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/DepthFirstSearch.java b/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/DepthFirstSearch.java old mode 100644 new mode 100755 index 238dc3e..16367eb --- a/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/DepthFirstSearch.java +++ b/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/DepthFirstSearch.java @@ -19,10 +19,7 @@ import es.usc.citius.hipster.model.Node; import es.usc.citius.hipster.model.function.NodeExpander; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.Stack; +import java.util.*; /** *
@@ -90,13 +87,13 @@ public boolean isProcessed() {
* DFS iterator used to expand always the deepest non-visited node.
*/
public class Iterator implements java.util.Iterator
@@ -81,7 +82,7 @@ private class StackFrameNode {
* backtracking.
*/
public class Iterator implements java.util.Iterator closed = new HashSet();
protected boolean graphSupport = true;
protected Iterator(){
- this.stack.add(new StackFrameNode(initialNode));
+ this.stack.addLast(new StackFrameNode(initialNode));
}
@@ -155,14 +152,14 @@ protected StackFrameNode processNextNode(){
if (stack.isEmpty()) return null;
- // Take current node in the stack but do not remove
- StackFrameNode current = stack.peek();
+ // Take last node in the stack but do not remove
+ StackFrameNode current = stack.peekLast();
// Find a successor
if (current.successors.hasNext()){
N successor = current.successors.next();
// push the node (if not explored)
if (!graphSupport || !closed.contains(successor.state())) {
- stack.add(new StackFrameNode(successor));
+ stack.addLast(new StackFrameNode(successor));
}
return current;
} else {
@@ -170,15 +167,15 @@ protected StackFrameNode processNextNode(){
if (current.visited){
current.processed = true;
}
- return stack.pop();
+ return stack.removeFirst();
}
}
- public Stack> nonDominated;
- //auxiliar variable which stores an empty list to avoid nullable values in code
+ //auxiliary variable which stores an empty list to avoid nullable values in code
private final Collection