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; }
public boolean removeActiveVessel(Craft aActiveVessel) { boolean wasRemoved = false; if (activeVessels.contains(aActiveVessel)) { activeVessels.remove(aActiveVessel); aActiveVessel.setCanalNetwork(null); wasRemoved = true; } return wasRemoved; }