Example #1
0
 /**
  * Test if a Node has all Edges from the same Nodes and another Node.
  *
  * @param n node to check
  * @return true if this Node has Edges from the same Nodes as n
  */
 protected boolean hasEquivalentEnteringEdges(Node n) {
   if (enteringEdges.size() != n.getEnteringEdges().size()) {
     return false;
   }
   for (Edge e : enteringEdges) {
     Node fromNode = e.getFromNode();
     if (!n.hasEdgeFromNode(fromNode)) {
       return false;
     }
   }
   return true;
 }
Example #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()));
 }