/** * Count the number of children. * @param node The node. * @return The number of children. */ protected int getChildCount(INode node) { int ret = 0; if(node instanceof ITupleSourceNode) { ITupleSourceNode tsn = (ITupleSourceNode)node; ITupleConsumerNode[] cs = tsn.getTupleConsumers(); ret += cs==null? 0: cs.length; } if(node instanceof IObjectSourceNode) { IObjectSourceNode tsn = (IObjectSourceNode)node; IObjectConsumerNode[] cs = tsn.getObjectConsumers(); ret += cs==null? 0: cs.length; } return ret; }
/** * Do clone makes a deep clone without regarding cycles. * Method is overridden by subclasses to actually incorporate their attributes. * @param theclone The clone. */ protected void doClone(Object theclone) { InitialFactNode clone = (InitialFactNode)theclone; // Deep clone tuple consumers clone.tconsumers = new ITupleConsumerNode[tconsumers.length]; for(int i=0; i<tconsumers.length; i++) clone.tconsumers[i] = (ITupleConsumerNode)tconsumers[i].clone(); // Set the source clone.osource = (IObjectSourceNode)osource.clone(); } }
/** * 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; } }
if(nodesharing) IObjectConsumerNode[] ocon = s.getObjectConsumers(); for(int i=0; lia==null && ocon!=null && i<ocon.length; i++) s.addObjectConsumer(lia);
source.removeObjectConsumer(consumer); removeNodeUsage(source);
IObjectConsumerNode c = (IObjectConsumerNode)consumer; s.addObjectConsumer(c); c.setObjectSource(s);
if(nodesharing) IObjectConsumerNode[] ocon = s.getObjectConsumers(); for(int i=0; lia==null && ocon!=null && i<ocon.length; i++) s.addObjectConsumer(lia);
source.removeObjectConsumer(consumer); removeNodeUsage(source);
IObjectConsumerNode c = (IObjectConsumerNode)consumer; s.addObjectConsumer(c); c.setObjectSource(s);
/** * Count the number of children. * @param node The node. * @return The number of children. */ protected int getChildCount(INode node) { int ret = 0; if(node instanceof ITupleSourceNode) { ITupleSourceNode tsn = (ITupleSourceNode)node; ITupleConsumerNode[] cs = tsn.getTupleConsumers(); ret += cs==null? 0: cs.length; } if(node instanceof IObjectSourceNode) { IObjectSourceNode tsn = (IObjectSourceNode)node; IObjectConsumerNode[] cs = tsn.getObjectConsumers(); ret += cs==null? 0: cs.length; } return ret; }
/** * Do clone makes a deep clone without regarding cycles. * Method is overridden by subclasses to actually incorporate their attributes. * @param theclone The clone. */ protected void doClone(Object theclone) { InitialFactNode clone = (InitialFactNode)theclone; // Deep clone tuple consumers clone.tconsumers = new ITupleConsumerNode[tconsumers.length]; for(int i=0; i<tconsumers.length; i++) clone.tconsumers[i] = (ITupleConsumerNode)tconsumers[i].clone(); // Set the source clone.osource = (IObjectSourceNode)osource.clone(); } }
/** * 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; } }
beta.getTupleSource().removeTupleConsumer(beta); IObjectSourceNode osource = beta.getObjectSource(); osource.removeObjectConsumer(beta); context.setLastBetaNode(beta.getTupleSource()); context.setLastAlphaNode(osource);
if(node instanceof IObjectSourceNode) IObjectConsumerNode[] consumers = ((IObjectSourceNode)node).getObjectConsumers(); for(int j=0; j<consumers.length; j++)
/** * Do clone makes a deep clone without regarding cycles. * Method is overridden by subclasses to actually incorporate their attributes. * @param theclone The clone. */ protected void doClone(Object theclone) { LeftInputAdapterNode clone = (LeftInputAdapterNode)theclone; // Deep clone tuple consumers clone.tconsumers = new ITupleConsumerNode[tconsumers.length]; for(int i=0; i<tconsumers.length; i++) clone.tconsumers[i] = (ITupleConsumerNode)tconsumers[i].clone(); // Set the source clone.osource = (IObjectSourceNode)osource.clone(); // Shallow copy the relevant attributes if(relevants!=null) clone.relevants = (AttributeSet)((AttributeSet)relevants).clone(); } }
Collection input = getObjectSource().getNodeMemory(mem); if(input!=null)
beta.getTupleSource().removeTupleConsumer(beta); IObjectSourceNode osource = beta.getObjectSource(); osource.removeObjectConsumer(beta); context.setLastBetaNode(beta.getTupleSource()); context.setLastAlphaNode(osource);
if(node instanceof IObjectSourceNode) IObjectConsumerNode[] consumers = ((IObjectSourceNode)node).getObjectConsumers(); for(int j=0; j<consumers.length; j++)
/** * Do clone makes a deep clone without regarding cycles. * Method is overridden by subclasses to actually incorporate their attributes. * @param theclone The clone. */ protected void doClone(Object theclone) { LeftInputAdapterNode clone = (LeftInputAdapterNode)theclone; // Deep clone tuple consumers clone.tconsumers = new ITupleConsumerNode[tconsumers.length]; for(int i=0; i<tconsumers.length; i++) clone.tconsumers[i] = (ITupleConsumerNode)tconsumers[i].clone(); // Set the source clone.osource = (IObjectSourceNode)osource.clone(); // Shallow copy the relevant attributes if(relevants!=null) clone.relevants = (AttributeSet)((AttributeSet)relevants).clone(); } }
Collection input = getObjectSource().getNodeMemory(mem); if(input!=null)