
package AOMCase;

import com.metamaxim.modelscope.callbacks.*;

public class AccomplishInternalMission extends Event {

  public void handleEvent() {
	  //Send the Accomplish Internal Mission event to the model to change its state to accomplished
	  this.submitToModel();
	  //Unassign all Resources for this Mission
	  Instance[] myAssignedResources = this.getInstance("Mission").selectByRef("Internal Resource", "Mission");
	  for (int i = 0; i < myAssignedResources.length; i++) {
		  Event releaseResource = this.createEvent("Release Internal Resource");
		  releaseResource.setInstance("Internal Resource", myAssignedResources[i]);
		  releaseResource.submitToModel();
		  }
	  }

}


