示例#1
0
 /**
  * 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;
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
 /**
  * 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;
 }