Example #1
0
 public boolean addActiveVessel(Craft aActiveVessel) {
   boolean wasAdded = false;
   if (activeVessels.contains(aActiveVessel)) {
     return false;
   }
   CanalNetwork existingCanalNetwork = aActiveVessel.getCanalNetwork();
   if (existingCanalNetwork == null) {
     aActiveVessel.setCanalNetwork(this);
   } else if (!this.equals(existingCanalNetwork)) {
     existingCanalNetwork.removeActiveVessel(aActiveVessel);
     addActiveVessel(aActiveVessel);
   } else {
     activeVessels.add(aActiveVessel);
   }
   wasAdded = true;
   return wasAdded;
 }
Example #2
0
 public boolean removeActiveVessel(Craft aActiveVessel) {
   boolean wasRemoved = false;
   if (activeVessels.contains(aActiveVessel)) {
     activeVessels.remove(aActiveVessel);
     aActiveVessel.setCanalNetwork(null);
     wasRemoved = true;
   }
   return wasRemoved;
 }