Android Open Source - ubisoldiers Squad






From Project

Back to project page ubisoldiers.

License

The source code is released under:

MIT License

If you think the Android project ubisoldiers listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.gobbisanches.ubisoldiers.mechanics;
/*from w  w w  .ja va2  s .  c om*/
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Sanches on 29/06/2014.
 */
public class Squad implements Serializable {
    private static final long serialVersionUID = 1L;
    private final ArrayList<Unit> units;

    public Squad(List<Unit> units) {
        if (units.size() != 3) {
            throw new RuntimeException("Squad must have exactly three units, but " + units.size() + " were provided");
        }

        for (Unit u : units) {
            if (u == null) {
                throw new RuntimeException("Squad must not have any units which are null");
            }
        }

        this.units = new ArrayList(units);
    }

    public Squad(Squad other) {
        this(other.units);
    }

    public void setUnit(int index, Unit unit) {
        if ((index < 0) || (index > 2)) {
            throw new RuntimeException("Invalid index for unit in squad: " + index);
        }

        this.units.set(index, unit);
    }

    public final Unit getUnit(int index) {
        if ((index < 0) || (index > 2)) {
            throw new RuntimeException("Invalid index for unit in squad: " + index);
        }

        return this.units.get(index);
    }
}




Java Source Code List

com.github.gobbisanches.ubisoldiers.app.ArmyFragment.java
com.github.gobbisanches.ubisoldiers.app.BattleActivity.java
com.github.gobbisanches.ubisoldiers.app.BattleFragment.java
com.github.gobbisanches.ubisoldiers.app.ItemListFragment.java
com.github.gobbisanches.ubisoldiers.app.MainActivity.java
com.github.gobbisanches.ubisoldiers.app.ResourceManager.java
com.github.gobbisanches.ubisoldiers.app.SingleFragmentActivity.java
com.github.gobbisanches.ubisoldiers.app.UbisoldierUosApplication.java
com.github.gobbisanches.ubisoldiers.app.UbisoldiersDriver.java
com.github.gobbisanches.ubisoldiers.app.UnitCustomizationActivity.java
com.github.gobbisanches.ubisoldiers.app.UnitCustomizationFragment.java
com.github.gobbisanches.ubisoldiers.app.UnitFragment.java
com.github.gobbisanches.ubisoldiers.app.UosManager.java
com.github.gobbisanches.ubisoldiers.mechanics.Armor.java
com.github.gobbisanches.ubisoldiers.mechanics.BattleLogEntry.java
com.github.gobbisanches.ubisoldiers.mechanics.BattleLogParser.java
com.github.gobbisanches.ubisoldiers.mechanics.BattleLog.java
com.github.gobbisanches.ubisoldiers.mechanics.BattleSquad.java
com.github.gobbisanches.ubisoldiers.mechanics.BattleUnit.java
com.github.gobbisanches.ubisoldiers.mechanics.Battle.java
com.github.gobbisanches.ubisoldiers.mechanics.DefaultGameRules.java
com.github.gobbisanches.ubisoldiers.mechanics.GameRules.java
com.github.gobbisanches.ubisoldiers.mechanics.General.java
com.github.gobbisanches.ubisoldiers.mechanics.ItemCollection.java
com.github.gobbisanches.ubisoldiers.mechanics.Item.java
com.github.gobbisanches.ubisoldiers.mechanics.MechanicsEngine.java
com.github.gobbisanches.ubisoldiers.mechanics.PolicyManager.java
com.github.gobbisanches.ubisoldiers.mechanics.SearchEngine.java
com.github.gobbisanches.ubisoldiers.mechanics.Soldier.java
com.github.gobbisanches.ubisoldiers.mechanics.Squad.java
com.github.gobbisanches.ubisoldiers.mechanics.Unit.java
com.github.gobbisanches.ubisoldiers.mechanics.Weapon.java