@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); } }
@OPERATION public void bid(double bidValue, int count) { if (!getObsProperty("running").booleanValue()) failed("auction not started"); getObsProperty("answer_count").updateValue(count + 1); ObsProperty opCurrentValue = getObsProperty("best_bid"); if (bidValue < opCurrentValue.doubleValue()) { // the bid is better than // the previous opCurrentValue.updateValue(bidValue); chosenAgent = getOpUserName(); // the name of the agent doing this // operation } System.out.println("Received bid " + bidValue + " from " + getOpUserName()); }