/** * Get the scope. * @return The scope. */ public ICapability getScope() { return new CapabilityWrapper(agent, getRPlan().getModelElement().getCapabilityName()); }
/** * Get the capability-specific fetcher (scope==null for agent scope). */ public static IValueFetcher getFetcher(final IInternalAccess agent, String scope) { return getFetcher(agent, scope, null); }
public IFuture<Tuple2<Boolean, Object>> evaluate(IEvent event) { Boolean ret = (Boolean)exp.getValue(CapabilityWrapper.getFetcher(getAgent(), uexp.getLanguage())); return new Future<Tuple2<Boolean, Object>>(ret!=null && ret.booleanValue()? TRUE: FALSE); } }, new IAction<Void>()
return new CapabilityWrapper(getComponent(), null);
/** * Evaluate the expression. * @return The value of the expression. */ public Object getValue() { return getParsedExpression().getValue(CapabilityWrapper.getFetcher(getAgent(), uexp.getLanguage())); }
/** * Get/Evaluate the updaterate value. * @param agent The agent. * @return The update rate. */ public long getUpdaterateValue(IInternalAccess agent) { long ret = -1; if(updaterate!=null) ret = ((Number)SJavaParser.parseExpression(updaterate, agent.getModel().getAllImports(), agent.getClassLoader()) .getValue(CapabilityWrapper.getFetcher(agent, updaterate.getLanguage()))).longValue(); return ret; }
/** * Get/Evaluate the updaterate value. * @param agent The agent. * @return The update rate. */ public long getUpdaterateValue(IInternalAccess agent) { long ret = -1; if(updaterate!=null) ret = ((Number)SJavaParser.parseExpression(updaterate, agent.getModel().getAllImports(), agent.getClassLoader()).getValue(CapabilityWrapper.getFetcher(agent, updaterate.getLanguage()))).longValue(); return ret; }
bindingparams = new HashMap<String, Object>(); IParsedExpression exp = SJavaParser.parseExpression(bo, agent.getModel().getAllImports(), agent.getClassLoader()); Object val = exp.getValue(CapabilityWrapper.getFetcher(agent, bo.getLanguage(), element!=null ? Collections.singletonMap(element.getFetcherName(), (Object)element) : null)); bindingparams.put(param.getName(), val);
public IFuture<Tuple2<Boolean, Object>> evaluate(IEvent event) { UnparsedExpression uexp = mcond.getExpression(); Boolean ret = (Boolean)SJavaParser.parseExpression(uexp, component.getModel().getAllImports(), component.getClassLoader()).getValue(CapabilityWrapper.getFetcher(component, uexp.getLanguage())); return new Future<Tuple2<Boolean, Object>>(ret!=null && ret.booleanValue()? TRUE: FALSE); } }}), createplan);
/** * 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); }
/** * Evaluate the condition. * @return */ public static boolean evaluateCondition(IInternalAccess agent, MCondition cond, MElement owner, Map<String, Object> vals) { boolean ret = false; UnparsedExpression uexp = cond.getExpression(); try { Object res = SJavaParser.getParsedValue(uexp, agent.getModel().getAllImports(), CapabilityWrapper.getFetcher(agent, uexp.getLanguage(), vals), agent.getClassLoader()); if(res instanceof Boolean) { ret = ((Boolean)res).booleanValue(); } else { agent.getLogger().warning("Condition does not evaluate to boolean: "+uexp.getValue()); } } catch(Exception e) { agent.getLogger().warning("Condition evaluation produced exception: "+uexp.getValue()+", "+e); } return ret; }
/** * 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); }
public IFuture<Tuple2<Boolean, Object>> evaluate(IEvent event) { UnparsedExpression uexp = mcond.getExpression(); Boolean ret = (Boolean)SJavaParser.parseExpression(uexp, getAgent().getModel().getAllImports(), getAgent().getClassLoader()).getValue(CapabilityWrapper.getFetcher(getAgent(), uexp.getLanguage(), values)); return new Future<Tuple2<Boolean, Object>>(ret!=null && ret.booleanValue()? TRUE: FALSE); } }, new IAction<Void>()
.getValue(CapabilityWrapper.getFetcher(getAgent(), mbel.getDefaultFact().getLanguage())); Iterator<?> it = SReflect.getIterator(tmp); while(it.hasNext()) .getValue(CapabilityWrapper.getFetcher(getAgent(), uexp.getLanguage())); tmpfacts.add(fact);
wrapFetcher(CapabilityWrapper.getFetcher(getAgent(), inivals.get(0).getLanguage()))); if(tmpvalue!=null && getClazz()!=null && SReflect.isSupertype(getClazz(), tmpvalue.getClass())) wrapFetcher(CapabilityWrapper.getFetcher(getAgent(), uexp.getLanguage()))));
component.getModel().getAllImports(), component.getClassLoader()).getValue(CapabilityWrapper.getFetcher(component, mbel.getDefaultFact().getLanguage()));
if(uexp!=null && uexp.getValue()!=null && uexp.getValue().length()>0) SimpleValueFetcher fet = new SimpleValueFetcher(CapabilityWrapper.getFetcher(agent, uexp.getLanguage())); fet.setValue(goal.getFetcherName(), goal); fet.setValue("$ref", other);
getComponent().getClassLoader()).getValue(CapabilityWrapper.getFetcher(getComponent(), param.getDefaultValue().getLanguage())); match = ((Boolean)exp.getValue(CapabilityWrapper.getFetcher(getComponent(), matchexp.getLanguage(), exparams))).booleanValue();
CapabilityWrapper.getFetcher(ia, uexp.getLanguage(), vals)); if(val instanceof Boolean) Object val = SJavaParser.getParsedValue(upex, null, CapabilityWrapper.getFetcher(ia, upex.getLanguage(), vals), null); if(val instanceof Boolean)
.getValue(CapabilityWrapper.getFetcher(getAgent(), upex.getLanguage())); if(SReflect.isIterable(value) && inibel.getFacts().size()==1) // Hack!!! support beliefset of iterable type with one initial element? .getValue(CapabilityWrapper.getFetcher(getAgent(), inibel.getFacts().get(0).getLanguage()));