@Override public String toString() { String str = new String(); for (Node s : this) { str += s.getName() + " "; } return str; }
public boolean isAccessible(Node node, int size) { Stack<Node> stack = new Stack<Node>(); stack.push(this); boolean[] visited = new boolean[size]; while (!stack.isEmpty()) { Node current_n = stack.pop(); if (!visited[current_n.getId()] && !current_n.isAbsorbant()) { visited[current_n.getId()] = true; if (current_n == node) return true; else for (Node tmp : this.getSuccessors()) stack.push(tmp); } else return false; } return false; }
protected boolean isAdjacent(Node goal, Matrix m) { for (int i = 0; i < this.getStates().size(); i++) for (int j = 0; j < goal.getStates().size(); j++) if (m.at(this.getStates().get(i).getId(), goal.getStates().get(j).getId()) > 0) return true; return false; }