for (Enumeration e = getWeapons(); e.hasMoreElements(); ) { Mounted weapon = (Mounted)e.nextElement();
for(Mounted weapon : getWeaponList()) {
    public void assignAMS(Vector vAttacks) {        for (Enumeration e = getWeapons(); e.hasMoreElements(); ) {            Mounted weapon = (Mounted)e.nextElement();            if (weapon.getType().hasFlag(WeaponType.F_AMS)) {                if (!weapon.isReady() || weapon.isMissing()) {                    continue;                }                // don't try if it's turned off                if (weapon.curMode().equals("Off")) {                    continue;                }                // make sure ammo is loaded                Mounted ammo = weapon.getLinked();                if (!(weapon.getType().hasFlag(WeaponType.F_ENERGY)) && ( ammo == null || ammo.getShotsLeft() == 0 ||                     ammo.isDumping() )) {                    loadWeapon(weapon);                    ammo = weapon.getLinked();                }                // try again                if (!(weapon.getType().hasFlag(WeaponType.F_ENERGY)) && ( ammo == null || ammo.getShotsLeft() == 0 ||                     ammo.isDumping() )) {                    // No ammo for this AMS.                    continue;                }                // make a new vector of only incoming attacks in arc                Vector vAttacksInArc = new Vector(vAttacks.size());                for (Enumeration i = vAttacks.elements(); i.hasMoreElements();) {                    WeaponAttackAction waa = (WeaponAttackAction)i.nextElement();                    if (Compute.isInArc(game, this.getId(), getEquipmentNum(weapon),                            game.getEntity(waa.getEntityId()))) {                        vAttacksInArc.addElement(waa);                    }                }                // find the most dangerous salvo by expected damage                WeaponAttackAction waa = Compute.getHighestExpectedDamage(game, vAttacksInArc);                if (waa != null) {                    waa.addCounterEquipment(weapon);                }            }        }    }