}
public static void readFactHandles(MarshallerReaderContext context) throws IOException,
ClassNotFoundException {
ObjectInputStream stream = context.stream;
InternalRuleBase ruleBase = context.ruleBase;
PlaceholderResolverStrategyFactory resolverStrategyFactory = context.resolverStrategyFactory;
InternalWorkingMemory wm = context.wm;
if ( stream.readBoolean() ) {
InternalFactHandle initialFactHandle = wm.getInitialFactHandle();
int sinkId = stream.readInt();
ObjectTypeNode initialFactNode = (ObjectTypeNode) context.sinks.get( sinkId );
ObjectHashSet initialFactMemory = (ObjectHashSet) context.wm.getNodeMemory( initialFactNode );
initialFactMemory.add( initialFactHandle );
readRightTuples( initialFactHandle,
context );
}
int size = stream.readInt();
// load the handles
InternalFactHandle[] handles = new InternalFactHandle[size];
for ( int i = 0; i < size; i++ ) {
InternalFactHandle handle = readFactHandle( context );
context.handles.put( handle.getId(),
handle );
handles[i] = handle;
context.wm.getObjectStore().addHandle( handle,
handle.getObject() );
readRightTuples( handle,
context );
}
EntryPointNode node = ruleBase.getRete().getEntryPointNode( EntryPoint.DEFAULT );
Map<ObjectType, ObjectTypeNode> objectTypeNodes = node.getObjectTypeNodes();
// add handles to object type nodes
for ( InternalFactHandle handle : handles ) {
Object object = handle.getObject();