/** * Get the variables. * @return The declared variables. */ public List getVariables() { if(depvars==null) { List vfvs = getVariablesForValueSource(getValueSource()); if(vfvs.isEmpty()) { depvars = vars; } else if(!vars.isEmpty()) { depvars = new ArrayList(vfvs); depvars.addAll(vars); } else { depvars = Collections.EMPTY_LIST; } } return depvars; }
/** * Get the variables. * @return The declared variables. */ public List getVariables() { if(depvars==null) { List vfvs = getVariablesForValueSource(getValueSource()); if(vfvs.isEmpty()) { depvars = vars; } else if(!vars.isEmpty()) { depvars = new ArrayList(vfvs); depvars.addAll(vars); } else { depvars = Collections.EMPTY_LIST; } } return depvars; }
/** * Get the string representation. * @return The string representation. */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("("); sbuf.append(getValueSource()); sbuf.append(getOperator()); if(vars.size()>1) { sbuf.append("("); for(int i=0; i<vars.size(); i++) { sbuf.append(vars.get(i)); } sbuf.append(")"); } else { sbuf.append(vars.get(0)); } sbuf.append(")"); return sbuf.toString(); } }
/** * Get the string representation. * @return The string representation. */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("("); sbuf.append(getValueSource()); sbuf.append(getOperator()); if(vars.size()>1) { sbuf.append("("); for(int i=0; i<vars.size(); i++) { sbuf.append(vars.get(i)); } sbuf.append(")"); } else { sbuf.append(vars.get(0)); } sbuf.append(")"); return sbuf.toString(); } }
/** * Test if all needed variables are available from the condition directly. * All variables must be declared as BoundConstraints with equal operator * in this object condition. * @return True, if can be evaluated in alpha network. */ protected boolean isAlphaExecutable(ICondition cond, IConstraint c) { boolean ret = cond instanceof ObjectCondition; if(ret) { Set available = new HashSet(); ObjectCondition ocond = (ObjectCondition)cond; List consts = ocond.getBoundConstraints(); for(int i = 0; i < consts.size(); i++) { BoundConstraint bc = (BoundConstraint)consts.get(i); if(bc.getOperator().equals(IOperator.EQUAL) && available.containsAll(Constraint.getVariablesForValueSource(bc.getValueSource()))) { available.addAll(bc.getBindVariables()); } } ret = available.containsAll(c.getVariables()); } return ret; }
/** * Test if all needed variables are available from the condition directly. * All variables must be declared as BoundConstraints with equal operator * in this object condition. * @return True, if can be evaluated in alpha network. */ protected boolean isAlphaExecutable(ICondition cond, IConstraint c) { boolean ret = cond instanceof ObjectCondition; if(ret) { Set available = new HashSet(); ObjectCondition ocond = (ObjectCondition)cond; List consts = ocond.getBoundConstraints(); for(int i = 0; i < consts.size(); i++) { BoundConstraint bc = (BoundConstraint)consts.get(i); if(bc.getOperator().equals(IOperator.EQUAL) && available.containsAll(Constraint.getVariablesForValueSource(bc.getValueSource()))) { available.addAll(bc.getBindVariables()); } } ret = available.containsAll(c.getVariables()); } return ret; }
&& !(((BoundConstraint)c).getValueSource() instanceof MethodCall) && !(((BoundConstraint)c).getValueSource() instanceof FunctionCall) && !(((BoundConstraint)c).getValueSource() instanceof List) && !(((BoundConstraint)c).getValueSource() instanceof OAVAttributeType) OAVObjectType type = bc.getValueSource()!=null ? ((OAVAttributeType)bc.getValueSource()).getType() : cond.getObjectType(); if(!(type instanceof OAVJavaType) || OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind())) IValueExtractor rightex = createValueExtractor(-1, bc.getValueSource(), subindex, context, false); ret.add(new ConstraintIndexer(leftex, rightex));
&& !(((BoundConstraint)c).getValueSource() instanceof MethodCall) && !(((BoundConstraint)c).getValueSource() instanceof FunctionCall) && !(((BoundConstraint)c).getValueSource() instanceof List) && !(((BoundConstraint)c).getValueSource() instanceof OAVAttributeType) OAVObjectType type = bc.getValueSource()!=null ? ((OAVAttributeType)bc.getValueSource()).getType() : cond.getObjectType(); if(!(type instanceof OAVJavaType) || OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind())) IValueExtractor rightex = createValueExtractor(-1, bc.getValueSource(), subindex, context, false); ret.add(new ConstraintIndexer(leftex, rightex));
binds[j] = ((Variable)vars.get(j)).isMulti()? SplitNode.MULTI: SplitNode.SINGLE; addSplitNode((OAVAttributeType)bc.getValueSource(), binds, context);
binds[j] = ((Variable)vars.get(j)).isMulti()? SplitNode.MULTI: SplitNode.SINGLE; addSplitNode((OAVAttributeType)bc.getValueSource(), binds, context);
VarInfo vi = new VarInfo(var, context.getTupleCount(), bc.getValueSource(), subindex); context.addVarInfo(vi); IValueExtractor ex1 = createValueExtractor(-1, bc.getValueSource(), subindex, context, false); IValueExtractor ex2 = getRightVariableExtractor(context, var); ret.add(new ConstraintEvaluator(bc.getOperator(), ex1, ex2)); IValueExtractor rightex = createValueExtractor(-1, bc.getValueSource(), subindex, context, false); IOperator op = bc.getOperator();
VarInfo vi = new VarInfo(var, context.getTupleCount(), bc.getValueSource(), subindex); context.addVarInfo(vi); IValueExtractor ex1 = createValueExtractor(-1, bc.getValueSource(), subindex, context, false); IValueExtractor ex2 = getRightVariableExtractor(context, var); ret.add(new ConstraintEvaluator(bc.getOperator(), ex1, ex2)); IValueExtractor rightex = createValueExtractor(-1, bc.getValueSource(), subindex, context, false); IOperator op = bc.getOperator();
throw new RuntimeException("Capability condition required to build belief (set) condition: "+name); BoundConstraint bc = context.getBoundConstraint(capvar); if(bc.getValueSource()!=null) throw new UnsupportedOperationException("Value source for capability object not yet supported."); throw new RuntimeException("Goal condition required to build parameter (set) condition: "+name); BoundConstraint bc = (BoundConstraint)context.getBoundConstraint(goalvar); if(bc!=null && bc.getValueSource()!=null) throw new UnsupportedOperationException("Value source for goal object not yet supported."); throw new RuntimeException("Plan condition required to build parameter (set) condition: "+name); BoundConstraint bc = (BoundConstraint)context.getBoundConstraint(planvar); if(bc!=null && bc.getValueSource()!=null) throw new UnsupportedOperationException("Value source for plan object not yet supported.");
valuesource = context.getBoundConstraint(((VariableExpression)value).getVariable()).getValueSource(); valuesource = context.getBoundConstraint(var).getValueSource(); context.pushCondition(context.getConstrainableCondition(var));
valuesource = context.getBoundConstraint(((VariableExpression)value).getVariable()).getValueSource(); valuesource = context.getBoundConstraint(var).getValueSource(); context.pushCondition(context.getConstrainableCondition(var));
Object valuesource = context.getBoundConstraint(varex.getVariable()).getValueSource(); OAVObjectType type = ((CastExpression)value).getType(); ret = new VariableExpression(context.generateVariableBinding(ocon, context.generateVariableName(), type, valuesource));
Object valuesource = context.getBoundConstraint(varex.getVariable()).getValueSource(); OAVObjectType type = ((CastExpression)value).getType(); ret = new VariableExpression(context.generateVariableBinding(ocon, context.generateVariableName(), type, valuesource));