if (organizationSub.hasChanged()) { Organization selfOrg = null;  for (Iterator orgIter = organizationSub.getCollection().iterator(); orgIter.hasNext(); ) { Organization org = (Organization) orgIter.next(); if (org.isSelf()) { selfOrg = org; break; } }  if (selfOrg != null) { Collection changeReports = organizationSub.getChangeReports(selfOrg); boolean checkUnallocated = false; if ((changeReports != AnonymousChangeReport.SET) && (changeReports != null)) { for (Iterator reportIterator = changeReports.iterator(); reportIterator.hasNext();) { ChangeReport report = (ChangeReport) reportIterator.next(); if (report instanceof RelationshipSchedule.RelationshipScheduleChangeReport) { checkUnallocated = true; break; } }  if (checkUnallocated) { for (int i = 0; i < tasksSub.length; i++) { CommandInfo c = allCommands[i]; if (c.type_id == CommandInfo.TYPE_ALLOCATE) { allocate((AllocateCommandInfo) c, tasksSub[i]); } } } } } }
  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]);      }    }  }