subtask.setDirectObject( aggAsset ); subtask.setPrepositionalPhrases( pps.elements() ); subtask.setVerb(TRANSPORTVERB); subtask.setPlan( parent_task.getPlan() );   Preference quantity_pf = createQuantityPreference(AspectType.QUANTITY, quantity); subtask.addPreference(quantity_pf);
String ofTypeString = THEATER_TRANSPORT;   PrepositionalPhrase pp_commodityType = parent_task.getPrepositionalPhrase(Constants.Preposition.OFTYPE); if (pp_commodityType != null) { String ind_obj = (String) pp_commodityType.getIndirectObject(); ofTypeString = ind_obj + "_" + ofTypeString; }
    private NewTask createTransportTask( Task parent_task, Task wdraw_task) {	// This is the part to transport	Asset part = parent_task.getDirectObject();	// This is the number of parts to transport	int quantity = (int)TaskUtils.getPreference(wdraw_task, AspectType.QUANTITY);  	NewTask subtask = ldmFactory_.newTask();		AggregateAsset aggAsset = (AggregateAsset)ldmFactory_.createAggregate(part, quantity);	subtask.setParentTask( parent_task );	// START TIME & END TIME        long parent_end =  TaskUtils.getEndTime(parent_task);  	long start = parent_end - TRANSPORT_TIME; 	long end  = parent_end;	Preference startPref = createTransportStartPref(start);    	subtask.addPreference(startPref);	Preference endPref = createTransportEndPref(end);	subtask.addPreference(endPref);	// Fill in preposition phrases.	Vector pps = new Vector();	// From		NewPrepositionalPhrase prep_phrase = ldmFactory_.newPrepositionalPhrase(); 	prep_phrase.setPreposition( Constants.Preposition.FROM );	Enumeration geolocs = AssetUtils.getGeolocLocationAtTime(myOrganization_, start);	GeolocLocation geoloc = null;	if (geolocs.hasMoreElements()) {	    geoloc = (GeolocLocation)geolocs.nextElement();	} else {	    try {//  		printDebug("SupplyExpander, Using HomeLocation for transport");		geoloc = (GeolocLocation)myOrganization_.getMilitaryOrgPG().getHomeLocation();	    } catch (NullPointerException npe) {		printError("SupplyExpander, Unable to find Location for Transport");	    }	}//  	printDebug("SupplyExpander, At "+TimeUtils.dateString(start)+ " the geoloc is "+geoloc);	prep_phrase.setIndirectObject(geoloc);	pps.addElement(prep_phrase);	// To	PrepositionalPhrase pp_to = parent_task.getPrepositionalPhrase(Constants.Preposition.TO);	if (pp_to != null) { 	    prep_phrase = ldmFactory_.newPrepositionalPhrase();	    prep_phrase.setPreposition( Constants.Preposition.TO );	    prep_phrase.setIndirectObject((GeolocLocation)pp_to.getIndirectObject());	    pps.addElement(prep_phrase);	}	else {	    // ???????????????????	    // What to do in this case?  Transport to nowhere?  just return at this point?	    printError("Missing TO Preposition on input task "+parent_task);	    return null;	}	// Ready at//  	prep_phrase = ldmFactory_.newPrepositionalPhrase();//  	prep_phrase.setPreposition( Preposition.READYAT );	// CHECK SCHEDULES -- RJB// 	Schedule s = ldmFactory_.newSimpleSchedule(allocated_date, allocated_date);//  	Schedule s = ldmFactory_.newSimpleSchedule(allocated_date, addNDays(allocated_date,1));//  	prep_phrase.setIndirectObject(s);//  	pps.addElement(prep_phrase);	// For	prep_phrase = ldmFactory_.newPrepositionalPhrase();	prep_phrase.setPreposition( Constants.Preposition.FOR );	String orgName = myOrganization_.getItemIdentificationPG().getItemIdentification();	prep_phrase.setIndirectObject(orgName);// 	prep_phrase.setIndirectObject(myOrganization_);	pps.addElement(prep_phrase);		String ofTypeString = THEATER_TRANSPORT;	// if parent task has an ofType <commodity> copy it into the Transport task	// this allows users of the transport task to do commodity based routing	PrepositionalPhrase pp_commodityType = parent_task.getPrepositionalPhrase(Constants.Preposition.OFTYPE);	if (pp_commodityType != null) {		String ind_obj = (String)pp_commodityType.getIndirectObject();		ofTypeString = ind_obj+"_"+ofTypeString;	}	// OfType	prep_phrase = ldmFactory_.newPrepositionalPhrase();	prep_phrase.setPreposition( Constants.Preposition.OFTYPE );	Asset transport_asset = 	    ldmFactory_.createPrototype("AbstractAsset", ofTypeString);	NewTypeIdentificationPG tipg = 	    (NewTypeIdentificationPG)transport_asset.getTypeIdentificationPG();	tipg.setTypeIdentification(ofTypeString);	prep_phrase.setIndirectObject(transport_asset);	pps.addElement(prep_phrase);	// Fill in verb.	subtask.setDirectObject( aggAsset );	subtask.setPrepositionalPhrases( pps.elements() );	subtask.setVerb(TRANSPORTVERB);	subtask.setPlan( parent_task.getPlan() );		// Quantity Preference 	Preference quantity_pf = createQuantityPreference(AspectType.QUANTITY, quantity);	subtask.addPreference(quantity_pf);	subtask.setSource( clusterId_ );	//  	printDebug("Created transport task:" + taskDesc(subtask));	return subtask;    }