allocate((AllocateCommandInfo) c, tasksSub[i]);
allocate((AllocateCommandInfo) c, tasksSub[i], i);
  public synchronized void execute() {    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) {		if (logger.isDebugEnabled())		  logger.debug(getAgentIdentifier() + " had RelatSched change on self org, so re-alloc all allocatable tasks.");		allocate((AllocateCommandInfo) c, tasksSub[i]);	      }	    }	  }	}      }    }    for (int i = 0; i < tasksSub.length; i++) {      if (tasksSub[i].hasChanged()) {	CommandInfo c = allCommands[i];	if (c.type_id == CommandInfo.TYPE_ALLOCATE) {	  if (logger.isDebugEnabled())	    logger.debug(getAgentIdentifier() + " has changed task supposed to allocate - will alloc all added");	  allocate((AllocateCommandInfo) c, tasksSub[i].getAddedCollection());	} else if (c.type_id == CommandInfo.TYPE_EXPAND) {	  // 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++) {		if (logger.isDebugEnabled())		  logger.debug(getAgentIdentifier() + " had un-planned expandable Task added to sub - will expand: " + task);		doExpansion(toTasks[j], task);	      }	    }	  }	} else {	  if (logger.isDebugEnabled()) {	    logger.debug("execute: unrecognized command type - " + c.type_id + 			 " - command ignored.");	  }	}      }    }          for (int i = 0; i < allocationsSub.length; i++) {      if (allocationsSub[i].hasChanged()) {	if (logger.isDebugEnabled())	  logger.debug(getAgentIdentifier() + " had changed Alloc -- will update results.");        updateAllocationResult(allocationsSub[i]);      }    }  }