/** * Get the nodes at the other ends of outgoing edges of this node. * * @return a list of child nodes */ public List<Node> getChildNodes() { LinkedList<Node> childNodes = new LinkedList<Node>(); for (Edge edge : leavingEdges) { childNodes.add(edge.getToNode()); } return childNodes; }
/** * given a node find the edge to that node * * @param n the node of interest * @return the edge to that node or <code> null</code> if no edge could be found. */ public Edge getEdgeToNode(Node n) { for (Edge e : leavingEdges) { if (e.getToNode() == n) { return e; } } return null; }
/** * Test if a Node has all Edges to the same Nodes and another Node. * * @param n the node of interest * @return true if this Node has all Edges to the sames Nodes as n */ public boolean hasEquivalentLeavingEdges(Node n) { if (leavingEdges.size() != n.getLeavingEdges().size()) { return false; } for (Edge e : leavingEdges) { Node toNode = e.getToNode(); if (!n.hasEdgeToNode(toNode)) { return false; } } return true; }