jill/src/main/java/io/github/agentsoz/jill/lang/PlanBindings.java
private final void setPlanVariables(Agent agent, Plan planInstance, Set<Belief> results,
      int choice) {
    if (agent == null || planInstance == null) {
      return;
    }
    Belief belief = getResultAtIndex(results, choice);
    if (belief == null) {
      return;
    }
    Object[] tuple = belief.getTuple();
    if (tuple == null) {
      return;
    }
    int index = 0;
    HashMap<String, Object> vars = new HashMap<String, Object>();
    for (Object o : belief.getTuple()) {
      try {
        String fieldname = ABeliefStore.getFieldName(agent.getId(), belief.getBeliefset(), index);
        vars.put(fieldname, o);
      } catch (BeliefBaseException e) {
        Log.error(
            "Agent " + agent.getId() + " could not retrive belief set field: " + e.getMessage());
      }
      index++;
    }
    planInstance.setPlanVariables(vars);
  }
private final void setPlanVariables(Agent agent, Plan planInstance, Set<Belief> results,
      int choice) {
    if (agent == null || planInstance == null) {
      return;
    }
    Belief belief = getResultAtIndex(results, choice);
    if (belief == null) {
      return;
    }
    Object[] tuple = belief.getTuple();
    if (tuple == null) {
      return;
    }
    int index = 0;
    HashMap<String, Object> vars = new HashMap<String, Object>();
    for (Object o : belief.getTuple()) {
      try {
        String fieldname = ABeliefStore.getFieldName(agent.getId(), belief.getBeliefset(), index);
        vars.put(fieldname, o);
      } catch (BeliefBaseException e) {
        Log.error(
            "Agent " + agent.getId() + " could not retrive belief set field: " + e.getMessage());
      }
      index++;
    }
    planInstance.setPlanVariables(vars);
  }
private final void setPlanVariables ( Agent agent , Plan planInstance , Set < Belief > results , int choice ) { if ( agent == null || planInstance == null ) { return ; } Belief belief = getResultAtIndex ( results , choice ) ; if ( belief == null ) { return ; } Object [ ] tuple = belief . getTuple ( ) ; if ( tuple == null ) { return ; } int index = 0 ; HashMap < String , Object > vars = new HashMap < String , Object > ( ) ; for ( Object o : belief . getTuple ( ) ) { try { String fieldname = ABeliefStore . getFieldName ( agent . getId ( ) , belief . getBeliefset ( ) , index ) ; vars . put ( fieldname , o ) ; } catch ( BeliefBaseException e ) { Log . error ( "Agent " + agent . getId ( ) + " could not retrive belief set field: " + e . getMessage ( ) ) ; } index ++ ; } planInstance . setPlanVariables ( vars ) ; }
Sets the plan instance variables using the given results set.

@param agent the agent for which this operation applies
@param planInstance the plan instance that is to be populated
@param results the beliefs set representing all plan bindings
@param choice index of the belief that is to be used to populate the plan instance variables
Sets the plan instance variables using the given results set .