コード例 #1
0
  public boolean isParent(NavigationNode node) {
    boolean result = false;

    if (node != null && node != this) {
      if (node.getParent() == this) {
        result = true;
      } else if (node.getParent() != null) {
        result = isParent(node.getParent());
      }
    }

    return result;
  }
コード例 #2
0
 public boolean equals(Object other) {
   boolean result = this == other;
   if (!result && other instanceof NavigationNode && getClass().equals(other.getClass())) {
     NavigationNode otherNode = (NavigationNode) other;
     result = getId().equals(otherNode.getId());
     if (result && !(getParent() == null && otherNode.getParent() == null)) {
       if (getParent() != null && otherNode.getParent() != null) {
         result = getParent().equals(otherNode.getParent());
       } else {
         result = false;
       }
     }
   }
   return result;
 }