Package edu.neu.ccs.task

Examples of edu.neu.ccs.task.TaskPlan


 
  protected void initPlan(int id, User user, Agent agent) throws Exception {
    TaskEngine engine = agent.getEngine();
    TaskModelSet modelSet = engine.getModelSet();
    QName topName = new QName(modelSet.getDefaultModel().getURI(), top);
    TaskPlan topPlan = engine.newTaskPlan(topName);
    Task topTask = topPlan.getTask();
   
    for (Map.Entry<String, String> e : topInputs.entrySet())
      topTask.setSlotValueScript(e.getKey(), e.getValue(), "init agent");
   
    if ( ! user.isGuest()) {
View Full Code Here


 
  private void initPlan(String user) {
    TaskEngine engine = agent.getEngine();
    TaskModelSet modelSet = engine.getModelSet();
    QName topName = new QName(modelSet.getDefaultModel().getURI(), top);
    TaskPlan topPlan = engine.newTaskPlan(topName);
    Task topTask = topPlan.getTask();
   
    for (Map.Entry<String, String> e : topInputs.entrySet())
      topTask.setSlotValueScript(e.getKey(), e.getValue(), "init agent");
   
    if (user != null) {
View Full Code Here

      "input slots unbound.")
  public void _run(String str) {
    Map<String, String> slots = new HashMap<String, String>();
    String name = parseTask(str, slots);
   
    TaskPlan plan = getEngine().newTaskPlan(
      XMLUtil.parseQName(getModelSet(), name));
    Task task = plan.getTask();
    for (Map.Entry<String, String> e : slots.entrySet())
      task.setSlotValueScript(e.getKey(), e.getValue(), "run task");
   
    if (plan.isStartable())
      agent.setFocus(plan);
    else {
      List<String> undef = task.getUndefinedInputs();
      if (undef.isEmpty())
        out.println("Cannot run " + task + ": precondition not met");
View Full Code Here

    return closeWithSuccess(agenda) || closeAny(agenda);
  }
 
  private boolean skipSufficientPostcondition(Plan p) {
    if (p instanceof TaskPlan) {
      TaskPlan task = (TaskPlan) p;
      if (Bool.isTrue(task.getTask().isAchieved())) {
        setFocus(task);
        task.close();
        return true;
      }
    }
   
    return false;
View Full Code Here

    return false;
  }
 
  private boolean performAtomic(Plan p) {
    if (p instanceof TaskPlan) {
      TaskPlan plan = (TaskPlan) p;
      Task task = plan.getTask();

      // First try to do it as a dialogue turn
      List<Turn> turns = getModelSet().getTurns(plan.getQName());
      for (Turn turn : Priority.copyShuffleSort(turns))
        if (Bool.maybeTrue(turn.isApplicable(task))) {
          setFocus(plan);
          setCurrentTurn(turn);
          return true;
        }

      // If not, try to execute a script
      List<Script> scripts = getModelSet().getScripts(plan.getQName());
      for (Script script : Priority.copyShuffleSort(scripts))
        if (Bool.maybeTrue(script.isApplicable(task))) {
          setFocus(plan);
          script.apply(task, true);
          performedFocus(null);
View Full Code Here

    xw.flush();
  }
 
  private void planTree(XMLStreamWriter xw, Plan plan) throws XMLStreamException {
    if (plan instanceof TaskPlan) {
      TaskPlan tp = (TaskPlan) plan;
      xw.writeStartElement("TASK");
      xw.writeAttribute("ID", tp.getTask().toString());
    } else if (plan instanceof DecompositionPlan) {
      DecompositionPlan dp = (DecompositionPlan) plan;
      xw.writeStartElement("RECIPE");
      xw.writeAttribute("ID", dp.getType().toString());
    } else if (plan instanceof StepPlan) {
View Full Code Here

TOP

Related Classes of edu.neu.ccs.task.TaskPlan

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.