System.out.println(getCluster().getMessageAddress() +
System.out.println(getMessageAddress() +
  public void execute()   {    //System.out.println(getCluster().getMessageAddress() + " In LoadAllocatorPlugin.execute");    for (Enumeration e = thisOrgSubs.getAddedList();e.hasMoreElements();) {      // only expecting one      thisOrg = (Organization)e.nextElement();      // Are we an MSB?      isTransporter = isMSB();//            	    System.out.println(getCluster().getMessageAddress() //            			       + " LoadAllocator got self "//            			       + thisOrg //          			       + " isTransporter " + isTransporter);      break;    }    // oplan is reset every time execute() runs    oplanStartTime = TimeSpan.MAX_VALUE;    for (Enumeration e = oplanSubs.elements(); e.hasMoreElements(); ) {      Oplan oplan = (Oplan) e.nextElement();      oplanStartTime = Math.min(oplanStartTime, oplan.getCday().getTime());    }    // We can't do anything without the oplan    if (oplanStartTime == TimeSpan.MAX_VALUE) return;    // change this: hard code end date for now    oplanEndTime = oplanStartTime + (long)(181 *  ScheduleUtilities.millisperday);	    // If we get to this point, we have the Oplan times and can create    // capacity objects. (No Oplan, no start or end dates)	    // Create Transport Capacities at MSB    if (isTransporter) {      if (fuelTransportCapacity == null) {        Capacity cap = createCapacity(BulkPOL.class, Constants.Verb.TRANSPORT);        if (cap != null) {          fuelTransportCapacity = new LACapacity(cap);          publishAdd(cap);        }      }      if (ammoTransportCapacity == null) {        Capacity cap = createCapacity(Ammunition.class, Constants.Verb.TRANSPORT);        if (cap != null) {          ammoTransportCapacity = new LACapacity(cap);          publishAdd(cap);        }      }    }    // Create Handling Capacities at FSB    else {      if (fuelHandlingCapacity == null) {        Capacity cap = createCapacity(BulkPOL.class, Constants.Verb.LOAD);        if (cap != null) {          fuelHandlingCapacity = new LACapacity(cap);          publishAdd(cap);        }      }      if (ammoHandlingCapacity == null) {        Capacity cap = createCapacity(Ammunition.class, Constants.Verb.LOAD);        if (cap != null) {          ammoHandlingCapacity = new LACapacity(cap);          publishAdd(cap);        }      }    }    // Load tasks    for(Enumeration e = loadTasks.getAddedList();e.hasMoreElements();)  {      Task task = (Task)e.nextElement();      if (isTransporter) {        System.out.println(getCluster().getMessageAddress() +                           " LoadAllocator: Why do we have LOAD Tasks here? Isn't this the MSB?");        break;      }      Asset asset = null;      if (task.getDirectObject() instanceof BulkPOL) {        asset = fuelHandlingCapacity.getCapacity();        fuelHandlingCapacity.changed(true);        //  		System.out.println(getCluster().getMessageAddress() + " LoadAllocator got Load fuel task");      }      else if (task.getDirectObject() instanceof Ammunition){        asset = ammoHandlingCapacity.getCapacity();        ammoHandlingCapacity.changed(true);        //  		System.out.println(getCluster().getMessageAddress() + " LoadAllocator got Load ammo task");      } else {        System.err.println(getCluster().getMessageAddress() + " LoadAllocator got task of unexpected type :"                            + task);        continue;      }      //  		System.out.println(getCluster().getMessageAddress() + "Creating AllocationResult for Load task");      AllocationResult allocation_result = computeAllocationResult(task);	        Allocation allocation =         theLDMF.createAllocation(task.getPlan(),                                 task,                                 asset,                                 allocation_result,                                 Constants.Role.HANDLER);//          	    System.out.println(getCluster().getMessageAddress() + " Allocating Handle Task " /*+ task*/ + " to " + asset);      publishAdd(allocation);      thePlan = task.getPlan();    }    // Transport tasks    for(Enumeration e = transportTasks.getAddedList();e.hasMoreElements();)  {      Task task = (Task)e.nextElement();      Role role = null;      Asset asset = null;      if (isTransporter) {        // We are the MSB, allocate to capacity        Object dobj = task.getDirectObject();        if (dobj instanceof BulkPOL) {          asset = fuelTransportCapacity.getCapacity();          fuelTransportCapacity.changed(true);	  role = Constants.Role.FUELTRANSPORTPROVIDER;          //  		    System.out.println(getCluster().getMessageAddress() + " LoadAllocator got Transport fuel task");        } else if (dobj  instanceof Ammunition){          asset = ammoTransportCapacity.getCapacity();          ammoTransportCapacity.changed(true);          //  		    System.out.println(getCluster().getMessageAddress() + " LoadAllocator got Transport ammo task");        } else if (dobj instanceof AggregateAsset){          Object o = ((AggregateAsset)task.getDirectObject()).getAsset();          if (o instanceof Ammunition) {            asset = ammoTransportCapacity.getCapacity();            ammoTransportCapacity.changed(true);          } else if (o instanceof BulkPOL) {            asset = fuelTransportCapacity.getCapacity();            fuelTransportCapacity.changed(true);          } else{	    // we don't deal with whatever ends up here	    continue;            //System.err.println(getCluster().getMessageAddress() + " LoadAllocator asset of unknown type: " + dobj);          }        }      }       // forward from FSB to MSB      else 	// Bad! This assumes that either one will do.        asset = getRoleProvider(Constants.Role.FUELTRANSPORTPROVIDER, false);      if (asset == null) 	// try again        asset = getRoleProvider(Constants.Role.AMMUNITIONTRANSPORTPROVIDER, false);      if (asset == null) {        System.err.println(getCluster().getMessageAddress() + " LoadAllocator - no MSB, can't forward the Transport task");      }      else {        // create and publish the allocation        //  		System.out.println(getCluster().getMessageAddress() + "Creating AllocationResult for Transport task");        AllocationResult allocation_result = computeAllocationResult(task);	          Allocation allocation =           theLDMF.createAllocation(task.getPlan(),                                   task,                                   asset,                                   allocation_result,                                   Constants.Role.TRANSPORTER);//    		System.out.println(getCluster().getMessageAddress() + "Allocating Transport Task " /*+ task*/ + " to " + asset);        publishAdd(allocation);        thePlan = task.getPlan();      }    }    // calculate capacity overruns    // if overruns on a given day, ask for more capacity    // assume we get new capacity, and add a QuantityScheduleElement to     // Capacity.ScheduleContentPG.Schedule with added capacity    if ((fuelHandlingCapacity !=null) && fuelHandlingCapacity.changed()) {      checkOverruns(fuelHandlingCapacity);      fuelHandlingCapacity.changed(false);    }    if ((ammoHandlingCapacity!=null) && ammoHandlingCapacity.changed()) {      checkOverruns(ammoHandlingCapacity);      ammoHandlingCapacity.changed(false);    }    if ((fuelTransportCapacity!=null) && fuelTransportCapacity.changed()) {      checkOverruns(fuelTransportCapacity);      fuelTransportCapacity.changed(false) ;    }    if ((ammoTransportCapacity!=null) && ammoTransportCapacity.changed()) {      checkOverruns(ammoTransportCapacity);      ammoTransportCapacity.changed(false);    }  }