ADD_TONS += task.getPreferredValue(AspectType.QUANTITY); tonsReceived += task.getPreferredValue(AspectType.QUANTITY);
double taskWeight = Sizer.getTaskMass(task).getShortTons(); ADD_TONS += taskWeight; tonsReceived += taskWeight;
  public void processNewTasks(Enumeration newTasks) {    ArrayList tasks = new ArrayList();    double tonsReceived = 0;    while (newTasks.hasMoreElements()) {      Task task = (Task)newTasks.nextElement();      if (task.getPlanElement() != null) {        getLoggingService().warn("Packer: Unable to pack - " + task.getUID() +                                  " - task already has a PlanElement - " +                                  task.getPlanElement() + ".\n" +                                 "Is the UniversalAllocator also handling Supply tasks in this node?");      } else {        if (getLoggingService().isInfoEnabled()) {          getLoggingService().info("Packer: Got a new task - " +                                    task.getUID() +                                    " from " + task.getSource());        }        ADD_TASKS++;        ADD_TONS += task.getPreferredValue(AspectType.QUANTITY);        tonsReceived += task.getPreferredValue(AspectType.QUANTITY);        tasks.add(task);      }    }    if (tasks.size() == 0) {      return;    }    if (getLoggingService().isInfoEnabled()) {      getLoggingService().info("Packer - number of added SUPPLY tasks: " +                                ADD_TASKS +                               ", aggregated quantity from added SUPPLY tasks: " +                                ADD_TONS + " tons.");    }    double tonsPacked = doPacking(tasks, getSortFunction(), getPreferenceAggregator(),				  getAllocationResultDistributor());    if ((tonsPacked > tonsReceived + 0.0001) || (tonsPacked < tonsReceived - 0.0001)) {      if (getLoggingService().isErrorEnabled()) {	getLoggingService().error("Packer - received " + tonsReceived + " tons but packed " + tonsPacked + 				  " tons, (total received " + ADD_TONS + " vs total packed " + Filler.TRANSPORT_TONS +				  ") for tasks : ");	for (Iterator iter = tasks.iterator(); iter.hasNext();) 	  getLoggingService().error ("\t" + ((Task) iter.next()).getUID());      }    }  }