@OPERATION
  void sense() {
    OpFeedbackParam<PersonSenseData[]> people = new OpFeedbackParam<>();
    OpFeedbackParam<PoTSenseData[]> points = new OpFeedbackParam<>();
    try {
      execLinkedOp("env-link", "sense", ID, people, points);
      ObsProperty peoplep = getObsProperty("people");
      ObsProperty pointsp = getObsProperty("points");

      peoplep.updateValue(toArray(people.get()));
      pointsp.updateValue(toArray(points.get()));

    } catch (Exception e) {
      e.printStackTrace();
      failed("Sense linked operation failed", "fail", ID, e);
    }
  }
Esempio n. 2
0
 @OPERATION
 public void getBalanceFromRestaurants() throws OperationException {
   Set<Integer> keys = restaurantTable.keySet();
   for (Integer key : keys) {
     ArrayList<ArtifactId> restaurants = restaurantTable.get(key);
     for (ArtifactId restaurant : restaurants) {
       // Double d = new Double(0);
       OpFeedbackParam<Double> d = new OpFeedbackParam<Double>();
       execLinkedOp(restaurant, "getBalance", d);
       double val = d.get();
       System.out.println("Balance for restaurant " + restaurant.getName() + " is: " + val);
       // System.out.println("Value: "+d);
     }
   }
   setPostEvaluationDone(true);
 }