public void recover(Entity unit) throws IllegalArgumentException { // If we can't load the unit, throw an exception. if (!canLoad(unit)) { throw new IllegalArgumentException("Can not recover " + unit.getShortName() + " into this bay. " + getUnused()); } currentSpace -= 1; // get the closest open recovery slot and make it unavailable closeSlot(); // Add the unit to our list of troops. troops.addElement(unit.getId()); }
/** * Load the given unit. * * @param unit * - the <code>Entity</code> to be loaded. * @exception - If the unit can't be loaded, an * <code>IllegalArgumentException</code> exception will be * thrown. */ @Override public void load(Entity unit) throws IllegalArgumentException { // If we can't load the unit, throw an exception. if (!canLoad(unit)) { throw new IllegalArgumentException("Can not load " + unit.getShortName() + " into this bay. " + getUnused()); } currentSpace -= 1; // Add the unit to our list of troops. troops.addElement(unit.getId()); }