コード例 #1
0
ファイル: Location.java プロジェクト: vicozizou/zidane
 public void removeLocation() {
   while (hasChildren()) {
     for (Location child : children) {
       child.removeLocation();
       child = null;
     }
   }
   if (parent != null) {
     parent.children.remove(this);
     if (parent.children.isEmpty()) {
       parent.children = null;
     }
     parent = null;
   }
 }
コード例 #2
0
ファイル: Location.java プロジェクト: vicozizou/zidane
 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;
   }
 }