コード例 #1
0
 public OngoingCountryConfiguration addArmies(final int armyCount) {
   final CountryArmyModel countryArmyModel = playMapModel.getCountryArmyModel();
   for (final Id country : countryIds) {
     final CountryPacket countryPacket =
         playMapModel.getCountryGraphModel().countryPacketWith(country);
     final MutatorResult<?> result =
         countryArmyModel.requestToAddArmiesToCountry(country, armyCount);
     if (result.failed()) {
       Exceptions.throwIllegalState(
           "Failed to add {} armies to country [{}]: {}",
           armyCount,
           countryPacket,
           result.getFailureReason());
     }
     result.commitIfSuccessful();
   }
   return this;
 }
コード例 #2
0
 public OngoingCountryConfiguration setOwner(final Id ownerId) {
   final CountryOwnerModel countryOwnerModel = playMapModel.getCountryOwnerModel();
   for (final Id country : countryIds) {
     final CountryPacket countryPacket =
         playMapModel.getCountryGraphModel().countryPacketWith(country);
     final MutatorResult<?> result =
         countryOwnerModel.requestToAssignCountryOwner(country, ownerId);
     if (result.failed()) {
       Exceptions.throwIllegalState(
           "Failed to assign country [{}] to owner [{}]: {}",
           countryPacket,
           ownerId,
           result.getFailureReason());
     }
     result.commitIfSuccessful();
   }
   return this;
 }