コード例 #1
0
 private void fillEngineHorsePowerMap(List<InventoryDto> inventories) {
   for (InventoryDto inventoryDto : inventories) {
     if (!engineHorsePowerMap.containsKey(inventoryDto.getStyle().getId())) {
       StyleDto styleDto =
           styleRestClient.findStyleById(
               inventoryDto.getStyle().getId(),
               RequestView.custom().add("engine").add("horsepower").buildIncludingFields());
       engineHorsePowerMap.put(
           inventoryDto.getStyle().getId(), styleDto.getEngine().getHorsepower());
     }
   }
 }
コード例 #2
0
 private double getInventoryHorsePowerCoeff(InventoryDto inventoryDto) {
   double horsePower = engineHorsePowerMap.get(inventoryDto.getStyle().getId());
   return (horsePower - MIN_HORSE_POWER) / (MAX_HORSE_POWER - MIN_HORSE_POWER);
 }