if (!(tasksSub[i].hasChanged())) continue; Enumeration eTasks = tasksSub[i].getAddedList(); if (!(eTasks.hasMoreElements())) continue; CommandInfo c = allCommands[i]; if (c.type_id == CommandInfo.TYPE_ALLOCATE) {  Organization capableOrg = null; do { Task theTask = (Task) eTasks.nextElement(); if (theTask.getPlanElement() == null) { if (capableOrg == null) { capableOrg = findCapableOrganization((AllocateCommandInfo)c); if (capableOrg == null) {  break; } } doAllocation(capableOrg, theTask); } } while (eTasks.hasMoreElements()); } else if (c.type_id == CommandInfo.TYPE_EXPAND) {  TaskInfo[] toTasks = ((ExpandCommandInfo)c).expandTasks; do { Task theTask = (Task) eTasks.nextElement(); if (theTask.getPlanElement() == null) { for (int j = 0; j < toTasks.length; j++) { doExpansion(toTasks[j], theTask); } } } while (eTasks.hasMoreElements()); } else {
if (tasksSub[i].hasChanged()) { CommandInfo c = allCommands[i]; if (c.type_id == CommandInfo.TYPE_ALLOCATE) { allocate((AllocateCommandInfo) c, tasksSub[i].getAddedCollection()); } else if (c.type_id == CommandInfo.TYPE_EXPAND) {  TaskInfo[] toTasks = ((ExpandCommandInfo)c).expandTasks; for (Iterator iterator = tasksSub[i].getAddedCollection().iterator(); iterator.hasNext();) { Task task = (Task) iterator.next(); if (task.getPlanElement() == null) { for (int j = 0; j < toTasks.length; j++) { doExpansion(toTasks[j], task); } } } } else { if (logger.isDebugEnabled()) { logger.debug("execute: unrecognized command type - " + c.type_id + " - command ignored."); } }
  public synchronized void execute() {//     if (organizationSub.hasChanged()) {//       AllocatorHelper.updateAllocationResult(organizationSub);//     }    for (int i = 0; i < tasksSub.length; i++) {      if (!(tasksSub[i].hasChanged()))         continue;      Enumeration eTasks = tasksSub[i].getAddedList();      if (!(eTasks.hasMoreElements()))        continue;      CommandInfo c = allCommands[i];      if (c.type_id == CommandInfo.TYPE_ALLOCATE) {        // allocate        Organization capableOrg = null;        do {          Task theTask = (Task) eTasks.nextElement();          if (theTask.getPlanElement() == null) {            if (capableOrg == null) {              capableOrg =                 findCapableOrganization((AllocateCommandInfo)c);              if (capableOrg == null) {                // no capable org found!                break;              }            }            doAllocation(capableOrg, theTask);          }        } while (eTasks.hasMoreElements());      } else if (c.type_id == CommandInfo.TYPE_EXPAND) {        // expand        TaskInfo[] toTasks = ((ExpandCommandInfo)c).expandTasks;        do {          Task theTask = (Task) eTasks.nextElement();          if (theTask.getPlanElement() == null) {            for (int j = 0; j < toTasks.length; j++) {              doExpansion(toTasks[j], theTask);            }          }        } while (eTasks.hasMoreElements());      } else {        // no other commands!      }    }    for (int i = 0; i < allocationsSub.length; i++) {      if (allocationsSub[i].hasChanged()) {        updateAllocationResult(allocationsSub[i]);      }    }  }