//so need to preserve, so we can restore after this node is added. LeftMemory and Terminal remain the same once set.
boolean objectMemory = context.isObjectTypeNodeMemoryEnabled();
boolean alphaMemory = context.isAlphaMemoryAllowed();
ObjectType objectType = pattern.getObjectType();
if ( pattern.getObjectType() instanceof ClassObjectType ) {
// Is this the query node, if so we don't want any memory
if ( DroolsQuery.class == ((ClassObjectType) pattern.getObjectType()).getClassType() ) {
context.setTupleMemoryEnabled( false );
context.setObjectTypeNodeMemoryEnabled( false );
context.setTerminalNodeMemoryEnabled( false );
context.setAlphaNodeMemoryAllowed( false );
}
}
context.setObjectSource( (ObjectSource) utils.attachNode( context,
new EntryPointNode( context.getNextId(),
context.getRuleBase().getRete(),
context ) ) );
ObjectTypeNode otn = new ObjectTypeNode( context.getNextId(),
(EntryPointNode) context.getObjectSource(),
objectType,
context );
if( objectType.isEvent() && EventProcessingOption.STREAM.equals( context.getRuleBase().getConfiguration().getEventProcessingMode() ) ) {
long expirationOffset = 0;
for( TypeDeclaration type : context.getRuleBase().getTypeDeclarations() ) {
if( type.getObjectType().isAssignableFrom( objectType ) ) {
expirationOffset = Math.max( type.getExpirationOffset(), expirationOffset );
}