public PropagateAction(MarshallerReaderContext context) throws IOException { this.node = (PropagationQueuingNode) context.sinks.get( context.readInt() ); }
public void read(MarshallerReaderContext inCtx) throws IOException, ClassNotFoundException { int sinkId = inCtx.readInt(); WindowNode windowNode = (WindowNode) inCtx.sinks.get( sinkId ); WindowMemory memory = (WindowMemory) inCtx.wm.getNodeMemory( windowNode ); Object[] behaviorContext = ( Object[] ) memory.behaviorContext; int i = inCtx.readInt(); // SlidingTimeWindowContext stwCtx = ( SlidingTimeWindowContext ) behaviorContext[i]; // // updateNextExpiration( stwCtx.queue.peek(), // inCtx.wm, // memory, // (SlidingTimeWindow) windowNode.getBehaviors()[i], // stwCtx ); }
public static void readSlidingLengthWindowBehaviour( WindowNode windowNode, WindowMemory memory, SlidingLengthWindow slw, SlidingLengthWindowContext slwCtx, MarshallerReaderContext inCtx ) throws IOException { int pos = inCtx.readInt(); int length = inCtx.readInt(); slwCtx.pos = pos; //FIXME: slwCtx.rightTuples = new RightTuple[length]; for (int i = 0; i < length; i++) { int factId = inCtx.readInt(); if (factId >= 0) { int sinkId = inCtx.readInt(); RightTupleSink sink = (RightTupleSink) inCtx.sinks.get( sinkId ); RightTupleKey key = new RightTupleKey( factId, sink ); RightTuple rightTuple = inCtx.rightTuples.get( key ); //FIXME: slwCtx.rightTuples[i] = rightTuple; } } }
public BehaviorExpireWMAction(MarshallerReaderContext inCtx) throws IOException { nodeId = inCtx.readInt(); WindowNode windowNode = (WindowNode) inCtx.sinks.get( nodeId ); memory = (WindowMemory) inCtx.wm.getNodeMemory( windowNode ); Object[] behaviorContext = ( Object[] ) memory.behaviorContext; int i = inCtx.readInt(); this.behavior = (SlidingTimeWindow) windowNode.getBehaviors()[i]; this.context = ( SlidingTimeWindowContext ) behaviorContext[i]; }
public static void readSlidingTimeWindowBehaviour( WindowNode windowNode, WindowMemory memory, SlidingTimeWindow stw, SlidingTimeWindowContext stwCtx, MarshallerReaderContext inCtx ) throws IOException { if (inCtx.readBoolean()) { int sinkId = inCtx.readInt(); int factId = inCtx.readInt(); RightTupleSink sink = (RightTupleSink) inCtx.sinks.get( sinkId ); RightTupleKey key = new RightTupleKey( factId, sink ); RightTuple rightTuple = inCtx.rightTuples.get( key ); //FIXME: stwCtx.expiringTuple = rightTuple; } if (inCtx.readBoolean()) { int size = inCtx.readInt(); for (int i = 0; i < size; i++) { int sinkId = inCtx.readInt(); int factId = inCtx.readInt(); RightTupleSink sink = (RightTupleSink) inCtx.sinks.get( sinkId ); RightTupleKey key = new RightTupleKey( factId, sink ); RightTuple rightTuple = inCtx.rightTuples.get( key ); //FIXME: stwCtx.queue.add( rightTuple ); } } }
public WorkingMemoryReteAssertAction(MarshallerReaderContext context) throws IOException { this.factHandle = context.handles.get( context.readInt() ); this.removeLogical = context.readBoolean(); this.updateEqualsMap = context.readBoolean(); if ( context.readBoolean() ) { String pkgName = context.readUTF(); String ruleName = context.readUTF(); Package pkg = context.ruleBase.getPackage( pkgName ); this.ruleOrigin = pkg.getRule( ruleName ); } if ( context.readBoolean() ) { this.leftTuple = context.terminalTupleMap.get( context.readInt() ); } }
public LogicalRetractCallback(MarshallerReaderContext context) throws IOException { this.tms = context.wm.getTruthMaintenanceSystem(); this.handle = context.handles.get( context.readInt() ); this.context = context.propagationContexts.get( context.readLong() ); this.activation = (Activation) context.terminalTupleMap.get( context.readInt() ).getObject(); this.beliefSet = (BeliefSet) this.tms.getJustifiedMap().get( handle.getId() ); for ( LinkedListEntry entry = (LinkedListEntry) beliefSet.getFirst(); entry != null; entry = (LinkedListEntry) entry.getNext() ) { final LogicalDependency node = (LogicalDependency) entry.getObject(); if ( node.getJustifier() == this.activation ) { this.node = node; break; } } }
public void read(MarshallerReaderContext inCtx) throws IOException, ClassNotFoundException { int leftTupleId = inCtx.readInt(); LeftTuple leftTuple = inCtx.terminalTupleMap.get( leftTupleId ); ScheduledAgendaItem item = ( ScheduledAgendaItem ) leftTuple.getObject(); Trigger trigger = InputMarshaller.readTrigger( inCtx ); DefaultAgenda agenda = ( DefaultAgenda ) inCtx.wm.getAgenda(); ActivationTimerJob job = new ActivationTimerJob(); ActivationTimerJobContext ctx = new ActivationTimerJobContext( trigger, item, agenda ); JobHandle jobHandle = ((InternalWorkingMemory)agenda.getWorkingMemory()).getTimerService().scheduleJob( job, ctx, trigger ); item.setJobHandle( jobHandle ); }
public static void readBehaviors( WindowNode windowNode, WindowMemory memory, MarshallerReaderContext inCtx ) throws IOException { short token = -1; while (( token = inCtx.readShort() ) != PersisterEnums.END) { int i = inCtx.readInt(); Object object = ( (Object[]) memory.behaviorContext )[i]; switch (token) { case PersisterEnums.SLIDING_TIME_WIN: { readSlidingTimeWindowBehaviour( windowNode, memory, (SlidingTimeWindow) windowNode.getBehaviors()[i], (SlidingTimeWindowContext) object, inCtx ); break; } case PersisterEnums.SLIDING_LENGTH_WIN: { readSlidingLengthWindowBehaviour( windowNode, memory, (SlidingLengthWindow) windowNode.getBehaviors()[i], (SlidingLengthWindowContext) object, inCtx ); break; } } } }
int repeatLimit = inCtx.readInt(); trigger.setRepeatLimit( repeatLimit ); int repeatCount = inCtx.readInt(); trigger.setRepeatCount( repeatCount ); trigger.setEndTime( new Date( endTime ) ); int repeatLimit = inCtx.readInt(); trigger.setRepeatLimit( repeatLimit ); int repeatCount = inCtx.readInt(); trigger.setRepeatCount( repeatCount ); if (inCtx.readBoolean()) {
public static InternalFactHandle readFactHandle( MarshallerReaderContext context ) throws IOException, ClassNotFoundException { int type = context.stream.readInt(); int id = context.stream.readInt(); long recency = context.stream.readLong(); int strategyIndex = context.stream.readInt(); Object object = null; ObjectMarshallingStrategy strategy = null;
public void read(MarshallerReaderContext inCtx) throws IOException, ClassNotFoundException { InternalFactHandle factHandle = inCtx.handles.get( inCtx.readInt() ); String entryPointId = inCtx.readUTF(); EntryPointNode epn = ((ReteooRuleBase) inCtx.wm.getRuleBase()).getRete().getEntryPointNode( new EntryPoint( entryPointId ) ); String className = inCtx.readUTF(); Class< ? > cls = ((ReteooRuleBase) inCtx.wm.getRuleBase()).getRootClassLoader().loadClass( className ); ObjectTypeNode otn = epn.getObjectTypeNodes().get( new ClassObjectType( cls ) ); long nextTimeStamp = inCtx.readLong(); TimerService clock = inCtx.wm.getTimerService(); JobContext jobctx = new ExpireJobContext( new WorkingMemoryReteExpireAction( factHandle, otn ), inCtx.wm ); JobHandle handle = clock.scheduleJob( job, jobctx, new PointInTimeTrigger( nextTimeStamp, null, null ) ); jobctx.setJobHandle( handle ); }