public void add(AbstractUnit units) {
            Specification spec = getSpecification();
            UnitType unitType = units.getUnitType(spec);
            int n = units.getNumber();
            boolean added = false;
            if (unitType.hasAbility(Ability.NAVAL_UNIT)) {
                for (AbstractUnit refUnit : navalUnits) {
                    if (refUnit.getUnitType(spec) == unitType) {
                        refUnit.setNumber(refUnit.getNumber() + n);
                        if (unitType.canCarryUnits()) {
                            capacity += unitType.getSpace() * n;
                        }
                        added = true;
                        break;
                    }
                }
                if (!added) navalUnits.add(units);
            } else {
                for (AbstractUnit refUnit : landUnits) {
                    if (refUnit.getUnitType(spec) == unitType
                        && refUnit.getRole().equals(units.getRole())) {
                        refUnit.setNumber(refUnit.getNumber() + n);
                        spaceRequired += unitType.getSpaceTaken() * n;
                        added = true;
                        break;
                    }
                }
                if (!added) landUnits.add(units);
            }
            updateSpaceAndCapacity();
        }