/** * Get the value fetcher. * @return The fetcher. */ public SimpleValueFetcher getFetcher() { if(fetcher==null) { this.fetcher = new SimpleValueFetcher() { public Object fetchValue(String name) { Object ret = null; if(getPropertyNames().contains(name)) { ret = getProperty(name); } else { ret = super.fetchValue(name); } return ret; } }; fetcher.setValue("$space", this); } return this.fetcher; }
public Object fetchValue(String name) { Object ret = null; if(getPropertyNames().contains(name)) { ret = getProperty(name); } else { ret = super.fetchValue(name); } return ret; } };
SimpleValueFetcher fetcher = new SimpleValueFetcher(ret); fetcher.setValue("$beliefbase", new BeliefbaseWrapper(capa.getBeliefbase(), prefix)); fetcher.setValue("$goalbase", new RGoalbase(agent, scope)); fetcher.setValue("$planbase", new PlanbaseWrapper(capa.getPlanbase(), prefix)); fetcher.setValue("$eventbase", new REventbase(agent, scope)); fetcher.setValue("$expressionbase", new ExpressionbaseWrapper(capa.getExpressionbase(), prefix)); if(values!=null) fetcher.setValues(values); SimpleValueFetcher fetcher = new SimpleValueFetcher(ret); fetcher.setValues(values); ret = fetcher;
/** * Add reason to fetcher. */ @Override public SimpleValueFetcher wrapFetcher(IValueFetcher fetcher) { SimpleValueFetcher ret = super.wrapFetcher(fetcher); if(reason instanceof RParameterElement) { ret.setValue(((RParameterElement)reason).getFetcherName(), reason); } return ret; }
/** * Create a new ExpressionCondition. */ public ExpressionCondition(UnparsedExpression expression, IValueFetcher fetcher) { this.expression = expression; this.fetcher = new SimpleValueFetcher(fetcher); }
/** * Evaluate the condition. */ public IFuture<Tuple2<Boolean, Object>> evaluate(IEvent event) { IFuture<Tuple2<Boolean, Object>> ret = null; try { fetcher.setValue("$event", event); IParsedExpression exp = SJavaParser.parseExpression(expression, null, null); // todo: classloader? Object res = exp.getValue(fetcher); ret = CommandCondition.evaluateResult(res); } catch(Exception e) { ret = new Future<Tuple2<Boolean, Object>>(e); // throw new RuntimeException(e); } return ret; }
/** * Wrap the fetcher to include the element itself. */ public SimpleValueFetcher wrapFetcher(final IValueFetcher fetcher) { SimpleValueFetcher ret = new SimpleValueFetcher(fetcher); ret.setValue(getFetcherName(), this); return ret; }
if(!draw) _fetcher.setValue("$object", sobj); _fetcher.setValue("$perspective", vp.getPerspective()); draw = ((Boolean)drawcondition.getValue(_fetcher)).booleanValue(); if(!soundActive) _fetcher.setValue("$object", sobj); _fetcher.setValue("$perspective", vp.getPerspective()); soundActive = ((Boolean)soundcondition.getValue(_fetcher)).booleanValue(); if(!animActive) _fetcher.setValue("$object", sobj); _fetcher.setValue("$perspective", vp.getPerspective()); animActive = ((Boolean)animationcondition.getValue(_fetcher)).booleanValue();
ret = super.fetchValue(name);
/** * Get the value fetcher. * @return The fetcher. */ public SimpleValueFetcher getFetcher() { if(fetcher==null) { this.fetcher = new SimpleValueFetcher(obscenter.getSpace().getFetcher()); fetcher.setValue("$perspective", this); } return this.fetcher; }
ret = super.fetchValue(name);
/** * Get the value fetcher. * * @return The fetcher. */ public SimpleValueFetcher getFetcher() { if(fetcher == null) { this.fetcher = new SimpleValueFetcher(obscenter.getSpace().getFetcher()); // fetcher.setValue("$space", obscenter.getSpace()); fetcher.setValue("$perspective", this); } return this.fetcher; }
super.fetchValue(name, object);
public Object createObject(Map args) throws Exception { Map sourceview = (Map)args.get("sourceview"); IEnvironmentSpace space = (IEnvironmentSpace)args.get("space"); IDataView ret = (IDataView)((Class)getProperty(sourceview, "clazz")).newInstance(); Map props = null; List lprops = (List)sourceview.get("properties"); if(lprops!=null) { SimpleValueFetcher fetcher = new SimpleValueFetcher(); fetcher.setValue("$space", space); fetcher.setValue("$object", args.get("object")); fetcher.setValue("$view", args.get(ret)); props = convertProperties(lprops, fetcher); } ret.init(space, props); return ret; } }, new BeanAccessInfo(AccessInfo.THIS)))
this.fetcher = new SimpleValueFetcher(space.getFetcher()); fetcher.setValue("$object", this);
SimpleValueFetcher fetcher = new SimpleValueFetcher(); fetcher.setValue("$space", envspace); fetcher.setValue("$time", Double.valueOf(time)); fetcher.setValue("$tick", Double.valueOf(tick)); for(int i=0; i<res.size(); i++) fetcher.setValue(key, val);
/** * Execute the query using a local parameter. * @param name The name of the local parameter. * @param value The value of the local parameter. * @return the result value of the query. */ public Object execute(String name, Object value) { SimpleValueFetcher fet = new SimpleValueFetcher(CapabilityWrapper.getFetcher(getAgent(), uexp.getLanguage())); fet.setValue(name, value); return getParsedExpression().getValue(fet); }
/** * Get the value fetcher. */ public IValueFetcher getFetcher() { assert !getComponentAdapter().isExternalThread(); if(fetcher==null) { SimpleValueFetcher fetcher = new SimpleValueFetcher(super.getFetcher()); if(microagent instanceof IPojoMicroAgent) { fetcher.setValue("$pojoagent", ((IPojoMicroAgent)microagent).getPojoAgent()); } this.fetcher = fetcher; } return fetcher; }
SimpleValueFetcher fetcher = new SimpleValueFetcher(); for(int i=0; i<obs.length; i++) fetcher.setValue("$object", obs[i]); if(((Boolean)includeexp.getValue(fetcher)).booleanValue()) SimpleValueFetcher fetcher = new SimpleValueFetcher(); for(int i=0; i<obs.length; i++) fetcher.setValue("$object", obs[i]); ret.add(dataexp.getValue(fetcher));
/** * Execute the query using local parameters. * @param names The names of parameters. * @param values The parameter values. * @return The return value. */ public Object execute(String[] names, Object[] values) { SimpleValueFetcher fet = new SimpleValueFetcher(CapabilityWrapper.getFetcher(getAgent(), uexp.getLanguage())); for(int i=0; i<names.length; i++) { fet.setValue(names[i], values[i]); } return getParsedExpression().getValue(fet); }