use of games.strategy.util.IntegerMap in project triplea by triplea-game.
the class UnitChooser method createDefaultSelectionsMap.
private static IntegerMap<UnitCategory> createDefaultSelectionsMap(final Collection<UnitCategory> categories) {
final IntegerMap<UnitCategory> defaultValues = new IntegerMap<>();
for (final UnitCategory category : categories) {
final int defaultValue = category.getUnits().size();
defaultValues.put(category, defaultValue);
}
return defaultValues;
}
use of games.strategy.util.IntegerMap in project triplea by triplea-game.
the class PacificTest method testCanLand1AirfieldStart.
@Test
public void testCanLand1AirfieldStart() {
bridge.setStepName("americanCombatMove");
final Route route = new Route();
route.setStart(unitedStates);
route.add(sz5);
route.add(sz7);
route.add(sz8);
route.add(sz20);
route.add(midway);
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(fighter, 1);
final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
// assertError( results);
}
use of games.strategy.util.IntegerMap in project triplea by triplea-game.
the class PacificTest method testCanLand1AirfieldEnd.
@Test
public void testCanLand1AirfieldEnd() {
bridge.setStepName("americanCombatMove");
final Route route = new Route();
route.setStart(unitedStates);
route.add(sz5);
route.add(sz7);
route.add(sz8);
route.add(sz20);
route.add(midway);
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(fighter, 1);
final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
}
use of games.strategy.util.IntegerMap in project triplea by triplea-game.
the class PacificTest method testCanLand2Airfields.
@Test
public void testCanLand2Airfields() {
bridge.setStepName("americanCombatMove");
final Route route = new Route();
route.setStart(unitedStates);
route.add(sz5);
route.add(sz4);
route.add(sz10);
route.add(sz16);
route.add(sz27);
route.add(newBritain);
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(fighter, 1);
final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
}
use of games.strategy.util.IntegerMap in project triplea by triplea-game.
the class PlaceDelegateTest method testCanNotProduceThatManyUnits.
@Test
public void testCanNotProduceThatManyUnits() {
final IntegerMap<UnitType> map = new IntegerMap<>();
map.add(infantry, 3);
final PlaceableUnits response = delegate.getPlaceableUnits(GameDataTestUtil.getUnits(map, british), westCanada);
assertTrue(response.getMaxUnits() == 2);
}
Aggregations