Skip to content

Commit

Permalink
#360 - simplify format of TimeslotUpdate message
Browse files Browse the repository at this point in the history
  • Loading branch information
jecollins committed Mar 25, 2012
1 parent 6d0f02c commit 9e65092
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/org/powertac/samplebroker/core/PowerTacBroker.java
Expand Up @@ -342,18 +342,20 @@ public synchronized void handleMessage (TimeslotUpdate tu)
Timeslot old = timeslotRepo.currentTimeslot();
timeService.updateTime(); // here is the clock update
log.info("TimeslotUpdate at " + timeService.getCurrentDateTime().toString());
List<Timeslot> enabled = tu.getEnabled();
//List<Timeslot> enabled = tu.getEnabled();
for (int index = old.getSerialNumber();
index < enabled.get(0).getSerialNumber();
index < tu.getFirstEnabled();
index ++) {
Timeslot closed =
timeslotRepo.findOrCreateBySerialNumber(index);
closed.disable();
currentTimeslot = index;
}
for (Timeslot ts : tu.getEnabled()) {
for (int index = tu.getFirstEnabled();
index <= tu.getLastEnabled();
index++) {
Timeslot open =
timeslotRepo.findOrCreateBySerialNumber(ts.getSerialNumber());
timeslotRepo.findOrCreateBySerialNumber(index);
open.enable();
}
}
Expand Down

0 comments on commit 9e65092

Please sign in to comment.