/** * 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(Tuple left, Object right, Object prefix, IOAVState state) { // Fetch the virtual fact Object object = tupleindex==-1? right: left.getObject(tupleindex); if(!(object instanceof VirtualFact)) { throw new RuntimeException("Multiextractor can only work with virtual fact: "+object); } VirtualFact vf = (VirtualFact)object; return vf.getSubAttributeValue(attr, subindex); }
/** * 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(Tuple left, Object right, Object prefix, IOAVState state) { // Fetch the virtual fact Object object = tupleindex==-1? right: left.getObject(tupleindex); if(!(object instanceof VirtualFact)) { throw new RuntimeException("Multiextractor can only work with virtual fact: "+object); } VirtualFact vf = (VirtualFact)object; return vf.getSubAttributeValue(attr, subindex); }
/** * Get the value or values of a sub attribute. * The subindex specifies the variable which should be accessed. * Each virtual fact has bindings for every subvariable, i.e. * the values contain for each variable its current values. * @param attr The attribute. * @param subindex The subindex. */ public Object getSubAttributeValue(OAVAttributeType attr, int subindex) { assert attr!=null; Object ret; if(attr.equals(getAttribute())) { ret = values.get(subindex); } else { ret = getSuperFact().getSubAttributeValue(attr, subindex); } return ret; }
/** * Get the value or values of a sub attribute. * The subindex specifies the variable which should be accessed. * Each virtual fact has bindings for every subvariable, i.e. * the values contain for each variable its current values. * @param attr The attribute. * @param subindex The subindex. */ public Object getSubAttributeValue(OAVAttributeType attr, int subindex) { assert attr!=null; Object ret; if(attr.equals(getAttribute())) { ret = values.get(subindex); } else { ret = getSuperFact().getSubAttributeValue(attr, subindex); } return ret; }