/** * Get the value of an attribute from an object or tuple. * @param left The left input tuple. * @param right The right input object. * @param prefix The prefix input object (last value from previous extractor in a chain). * @param state The working memory. */ public Object getValue(final Tuple left, final Object right, final Object prefix, final IOAVState state) { // Fetch the parameter values. Object[] paramvalues = new Object[extractors.length]; for(int i=0; i<paramvalues.length; i++) { //paramvalues[i] = extractors[i].getValue(left, right, prefix, state); final IValueExtractor ex = extractors[i]; paramvalues[i] = new ILazyValue() { public Object getValue() { return ex.getValue(left, right, prefix, state); } }; } // Invoke the function and return the value. Object ret = function.invoke(paramvalues, state); // System.out.println("Funcall result: "+this+" "+ret); return ret; }
argtypes[i] = funcall.getFunction().getReturnType();
/** * Test if a constraint evaluator is affected from a * change of a certain attribute. * @param tupleindex The tuple index. * @param attr The attribute. * @return True, if affected. */ public boolean isAffected(int tupleindex, OAVAttributeType attr) { boolean ret = false; for(int i=0; !ret && i<extractors.length; i++) { ret = extractors[i].isAffected(tupleindex, attr); } if(!ret) ret = function.getRelevantAttributes().contains(attr); return ret; }
argtypes[i] = funcall.getFunction().getReturnType();
/** * Test if a constraint evaluator is affected from a * change of a certain attribute. * @param tupleindex The tuple index. * @param attr The attribute. * @return True, if affected. */ public boolean isAffected(int tupleindex, OAVAttributeType attr) { boolean ret = false; for(int i=0; !ret && i<extractors.length; i++) { ret = extractors[i].isAffected(tupleindex, attr); } if(!ret) ret = function.getRelevantAttributes().contains(attr); return ret; }
ret = tmodel.getJavaType(((FunctionCall)valuesource).getFunction().getReturnType());
/** * Get the set of relevant attribute types. */ public AttributeSet getRelevantAttributes() { AttributeSet ret = new AttributeSet(); for(int i=0; i<extractors.length; i++) ret.addAll(extractors[i].getRelevantAttributes()); // System.out.println("function: "+function.getClass()); ret.addAll(function.getRelevantAttributes()); return ret; }
/** * Get the value of an attribute from an object or tuple. * @param left The left input tuple. * @param right The right input object. * @param prefix The prefix input object (last value from previous extractor in a chain). * @param state The working memory. */ public Object getValue(final Tuple left, final Object right, final Object prefix, final IOAVState state) { // Fetch the parameter values. Object[] paramvalues = new Object[extractors.length]; for(int i=0; i<paramvalues.length; i++) { //paramvalues[i] = extractors[i].getValue(left, right, prefix, state); final IValueExtractor ex = extractors[i]; paramvalues[i] = new ILazyValue() { public Object getValue() { return ex.getValue(left, right, prefix, state); } }; } // Invoke the function and return the value. Object ret = function.invoke(paramvalues, state); // System.out.println("Funcall result: "+this+" "+ret); return ret; }
ret = tmodel.getJavaType(((FunctionCall)valuesource).getFunction().getReturnType());
/** * Get the set of relevant attribute types. */ public AttributeSet getRelevantAttributes() { AttributeSet ret = new AttributeSet(); for(int i=0; i<extractors.length; i++) ret.addAll(extractors[i].getRelevantAttributes()); // System.out.println("function: "+function.getClass()); ret.addAll(function.getRelevantAttributes()); return ret; }
/** * * @param tmodel * @param valuesource * @return */ protected static OAVObjectType getValueSourceType(OAVTypeModel tmodel, Object valuesource) { OAVObjectType ret = null; if(valuesource instanceof OAVAttributeType) { ret = ((OAVAttributeType)valuesource).getType(); } else if(valuesource instanceof MethodCall) { Class rettype = ((MethodCall)valuesource).getMethod().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } else if(valuesource instanceof FunctionCall) { Class rettype = ((FunctionCall)valuesource).getFunction().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } return ret; }
/** * * @param tmodel * @param valuesource * @return */ protected static OAVObjectType getValueSourceType(OAVTypeModel tmodel, Object valuesource) { OAVObjectType ret = null; if(valuesource instanceof OAVAttributeType) { ret = ((OAVAttributeType)valuesource).getType(); } else if(valuesource instanceof MethodCall) { Class rettype = ((MethodCall)valuesource).getMethod().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } else if(valuesource instanceof FunctionCall) { Class rettype = ((FunctionCall)valuesource).getFunction().getReturnType(); if(rettype!=null) ret = tmodel.getJavaType(rettype); } return ret; }