addToAndPublishExpansion(gpTask,supplyTasks); demandTasks.addAll(supplyTasks);
if(addToAndPublishExpansion(gpTask,supplyTasks)) { demandTasks.addAll(supplyTasks); }
  public List generateDemandTasks(long start, long duration, Collection relevantProjectSupplys) {    ArrayList demandTasks = new ArrayList();    regenerateProjectionHash(relevantProjectSupplys);    long end = start + duration;    Iterator gpTasksIt = projHash.keySet().iterator();    while (gpTasksIt.hasNext()) {      Task gpTask = (Task) gpTasksIt.next();      ArrayList supplyTasks = new ArrayList();      HashMap assetMap = (HashMap) projHash.get(gpTask);      Iterator assetsIt = assetMap.keySet().iterator();      while (assetsIt.hasNext()) {        Asset consumed = (Asset) assetsIt.next();        Collection projTasks = (Collection) (assetMap.get(consumed));        double totalQty = deriveTotalQty(start, start+duration, projTasks);        if (totalQty <= 0.0) {          continue;        }        double taskQty = 0.0;        if (dgPlugin.getPoissonOn()) {          taskQty = poissonGen.nextPoisson(totalQty);        }        else {          taskQty = totalQty;        }        Iterator projTaskIt = projTasks.iterator();        if((taskQty > 0) && (projTaskIt.hasNext())) {          supplyTasks.add(createNewDemandTask(gpTask,                                                  (Task) projTaskIt.next(),                                                  consumed,                                                  start,                                                  start+duration,                                                  taskQty));        }      }      if(!supplyTasks.isEmpty()){        addToAndPublishExpansion(gpTask,supplyTasks);        demandTasks.addAll(supplyTasks);      }    }    return demandTasks;  }