Пример #1
0
 @Override
 public void handleNewObject(Object thing) {
   initMaybe();
   DistributionTransaction msg = (DistributionTransaction) thing;
   // contains meter counts and charge
   Broker broker = msg.getBroker();
   if (brokerDist.keySet().contains(broker)) {
     double amt = msg.getCharge();
     brokerDist.put(broker, brokerDist.get(broker) + amt);
   }
 }
 /** Handles a DistributionTransaction - charges for transporting power */
 public synchronized void handleMessage(DistributionTransaction dt) {
   log.info("Distribution tx: " + dt.getCharge());
 }