Beispiel #1
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Location other = (Location) obj;
   if (getId() == null) {
     if (other.getId() != null) return false;
   } else if (!getId().equals(other.getId())) return false;
   return true;
 }
Beispiel #2
0
 public void updateLocation(Location newLoc) {
   Location loc = findLocationById(newLoc.getId());
   if (loc != null) {
     if (loc.parent != null) {
       loc.parent.children.remove(loc);
       loc.parent.children.add(newLoc);
     }
     if (loc.children != null) {
       for (Location child : children) {
         child.parent = newLoc;
       }
     }
     newLoc.parent = loc.parent;
     newLoc.children = loc.children;
   }
 }