/** * Get the value at the index. * @param index The index. */ public Object getObject(int index) { Tuple target = this; for(int i=size-1; i>index; i--) target = target.getLastTuple(); return target.getObject(); }
/** * Get the value at the index. * @param index The index. */ public Object getObject(int index) { Tuple target = this; for(int i=size-1; i>index; i--) target = target.getLastTuple(); return target.getObject(); }
/** * Get the values. */ public List getObjects() { List ret = new LinkedList(); Tuple current = this; while(current!=null) { ret.add(0, current.getObject()); current = current.getLastTuple(); } return ret; }
/** * Get the values. */ public List getObjects() { List ret = new LinkedList(); Tuple current = this; while(current!=null) { ret.add(0, current.getObject()); current = current.getLastTuple(); } 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(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); }
/** * Check the consistency of the node. */ public boolean checkNodeConsistency(ReteMemory mem) { boolean consistent = true; Collection tuples = getNodeMemory(mem); Collection objects = getObjectSource().getNodeMemory(mem); if(tuples!=null) { for(Iterator it=tuples.iterator(); consistent && it.hasNext(); ) { Tuple tuple = (Tuple)it.next(); consistent = objects.contains(tuple.getObject()); } } Object node = this; while(node instanceof IObjectConsumerNode) node = ((IObjectConsumerNode)node).getObjectSource(); ((ReteNode)node).checked.add(this); return consistent; } }
/** * 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 object from the tuple // a) attr == null -> use object // b) attr !=null -> use object.getXYZ() Object object = left.getObject(tupleindex); if(object instanceof VirtualFact) object = ((VirtualFact)object).getObject(); if(attr!=null) { object = ((OAVJavaAttributeType)attr).accessProperty(object); } return object; }
/** * Check the consistency of the node. */ public boolean checkNodeConsistency(ReteMemory mem) { boolean consistent = true; Collection tuples = getNodeMemory(mem); Collection objects = getObjectSource().getNodeMemory(mem); if(tuples!=null) { for(Iterator it=tuples.iterator(); consistent && it.hasNext(); ) { Tuple tuple = (Tuple)it.next(); consistent = objects.contains(tuple.getObject()); } } Object node = this; while(node instanceof IObjectConsumerNode) node = ((IObjectConsumerNode)node).getObjectSource(); ((ReteNode)node).checked.add(this); return consistent; } }
/** * 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 object from the tuple // a) attr == null -> use object // b) attr !=null -> use object.getXYZ() Object object = left.getObject(tupleindex); if(object instanceof VirtualFact) object = ((VirtualFact)object).getObject(); if(attr!=null) { object = ((OAVJavaAttributeType)attr).accessProperty(object); } return object; }
Object object = left.getObject(tupleindex);
Object object = left.getObject(tupleindex);