Beispiel #1
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;
 }
Beispiel #2
0
 /**
  * Returns true if the given node is equivalent to this node. Two nodes are equivalent only if
  * they have the same word, the same number of entering and leaving edges, and that their begin
  * and end times are the same.
  *
  * @param other the Node we're comparing to
  * @return true if the Node is equivalent; false otherwise
  */
 public boolean isEquivalent(Node other) {
   return ((word.getSpelling().equals(other.getWord().getSpelling())
           && (getEnteringEdges().size() == other.getEnteringEdges().size()
               && getLeavingEdges().size() == other.getLeavingEdges().size()))
       && (getBeginTime() == other.getBeginTime() && endTime == other.getEndTime()));
 }