@Override public int getPopulation () { return customerInfo.getPopulation(); }
public int getPopulation (CustomerInfo customer) { return customer.getPopulation(); }
void signup (int population) { subscribedPopulation = Math.min(customer.getPopulation(), subscribedPopulation + population); }
private void ensureBootProfiles () { if (0 == bootProfiles.size()) { for (CustomerInfo customer : customerRepo.list()) { bootProfiles.put(customer, new CustomerRecord(customer, customer.getPopulation())); } } }
private void handleRegulation (int day, int hour, TariffSubscription sub) { if (null == sub) return; // check for non-zero regulation request double actualRegulation = sub.getRegulation() * customerInfo.getPopulation(); if (Math.abs(actualRegulation) < capacityEpsilon) { return; } // compute the regulation factor and do the regulation log.info("{} regulate: {}", name, actualRegulation); double startCapacity = currentCapacity; try { if (actualRegulation > capacityEpsilon) { discharge(actualRegulation); } else if (actualRegulation < -capacityEpsilon) { charge(-1 * actualRegulation); } } catch (ChargeException ce) { log.error(name +" : "+ ce); } if (Math.abs(startCapacity - currentCapacity) > capacityEpsilon) { log.info(String.format("%s regulated from %.1f to %.1f", name, startCapacity, currentCapacity)); } }
public void subscribeDefault (TariffMarket tariffMarketService) { for (CustomerInfo customer: getCustomerInfos()) { Tariff candidate = tariffMarketService.getDefaultTariff(customer.getPowerType()); if (null == candidate) { log.error("No default tariff for " + customer.getPowerType().toString()); } tariffMarketService.subscribeToTariff(candidate, customer, customer.getPopulation()); } }
.getDefaultTariff(cust.getPowerType()), cust, cust.getPopulation()); customerRepo.add(cust);
* customer.getPopulation()
public void subscribeDefault (TariffMarket tariffMarketService) { for (CustomerInfo customer: getCustomerInfos()) { Tariff candidate = tariffMarketService.getDefaultTariff(customer.getPowerType()); if (null == candidate) { log.error("No default tariff for " + customer.getPowerType().toString()); } else { log.info("Subscribe " + customer.getName() + " to " + candidate.getPowerType().toString()); } tariffMarketService.subscribeToTariff(candidate, customer, customer.getPopulation()); } }
record = new CustomerRecord(customer, customer.getPopulation()); customerMap.put(customer, record);