Package org.drools.core.common

Examples of org.drools.core.common.InternalFactHandle


        boolean needsWrapping = ! ( core instanceof TraitableBean );

        ClassDefinition coreDef = lookupClassDefinition( core );
        TraitableBean<K,? extends TraitableBean> inner = needsWrapping ? builder.asTraitable( core, coreDef ) : (TraitableBean<K,? extends TraitableBean>) core;
        if ( needsWrapping ) {
            InternalFactHandle h = (InternalFactHandle) lookupFactHandle( core );
            InternalWorkingMemoryEntryPoint ep = h != null ? (InternalWorkingMemoryEntryPoint) h.getEntryPoint() : (InternalWorkingMemoryEntryPoint) ((StatefulKnowledgeSessionImpl)workingMemory).getEntryPoint("DEFAULT");
            ObjectTypeConfigurationRegistry reg = ep.getObjectTypeConfigurationRegistry();

            ObjectTypeConf coreConf = reg.getObjectTypeConf( ep.getEntryPoint(), core );

            ObjectTypeConf innerConf = reg.getObjectTypeConf( ep.getEntryPoint(), inner );
View Full Code Here


    @SuppressWarnings("unchecked")
    public InternalFactHandle createFactHandle(final LeftTuple leftTuple,
                                                final PropagationContext context,
                                                final InternalWorkingMemory workingMemory) {
        InternalFactHandle handle = null;
        ProtobufMessages.FactHandle _handle = null;
        if( context.getReaderContext() != null ) {
            Map<ProtobufInputMarshaller.TupleKey, ProtobufMessages.FactHandle> map = (Map<ProtobufInputMarshaller.TupleKey, ProtobufMessages.FactHandle>) context.getReaderContext().nodeMemories.get( getId() );
            if( map != null ) {
                _handle = map.get( PersisterHelper.createTupleKey( leftTuple ) );
View Full Code Here

            }

            RightTuple rightTuple = new RightTuple( evFh, this );
            rightTuple.setPropagationContext( pctx );

            InternalFactHandle clonedFh = evFh.cloneAndLink()// this is cloned, as we need to separate the child RightTuple references
            rightTuple.setObject( clonedFh );

            // process the behavior
            if (!behavior.assertFact(memory, clonedFh, pctx, workingMemory)) {
                return;
View Full Code Here

            behavior.retractFact(memory, rightTuple.getFactHandle(), pctx, wm);
        } finally {
            memory.gate.unlock();
        }

        InternalFactHandle clonedFh = ( InternalFactHandle ) rightTuple.getObject();
        ObjectTypeNode.doRetractObject(clonedFh, pctx, wm);
    }
View Full Code Here

        try {
            final ObjectTypeNodeMemory omem = (ObjectTypeNodeMemory) wm.getNodeMemory( getObjectTypeNode());
            Iterator it = omem.getObjectHashSet().iterator();

            for (ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next()) {
                InternalFactHandle fh = (InternalFactHandle) entry.getValue();
                sink.assertObject(fh,
                                  context,
                                  wm);
            }
        } finally {
View Full Code Here

    public void updateSink(final ObjectSink sink,
                           final PropagationContext context,
                           final InternalWorkingMemory workingMemory) {
        this.updated++;
        for ( final Iterator it = this.facts.iterator(); it.hasNext(); ) {
            final InternalFactHandle handle = (InternalFactHandle) it.next();
            sink.assertObject( handle,
                               context,
                               workingMemory );
        }
    }
View Full Code Here

        MockLeftTupleSink sink = new MockLeftTupleSink(12);
        node.addTupleSink( sink );
        sink.attach(buildContext);
       
       
        InternalFactHandle s1 = (InternalFactHandle) this.workingMemory.insert( "string" );

        node.assertLeftTuple( new LeftTupleImpl( s1,
                                             node,
                                             true ),
                              context,
View Full Code Here

        ad.addObjectSink( al1 );
        ad.addObjectSink( al2 );
        ad.addObjectSink( al3 );

        InternalFactHandle handle = new ReteooFactHandleFactory().newFactHandle( new Cheese(),
                                                                                 null,
                                                                                 null,
                                                                                 new DisconnectedWorkingMemoryEntryPoint( "DEFAULT" ) );
        try {
            ad.propagateAssertObject( handle,
View Full Code Here

    @SuppressWarnings("unchecked")
    public InternalFactHandle createFactHandle(final PropagationContext context,
                                               final InternalWorkingMemory workingMemory,
                                               final LeftTuple leftTuple ) {
        InternalFactHandle handle = null;
        ProtobufMessages.FactHandle _handle = null;
        if( context.getReaderContext() != null ) {
            Map<TupleKey, QueryElementContext> map = (Map<TupleKey, QueryElementContext>) context.getReaderContext().nodeMemories.get( getId() );
            if( map != null ) {
                _handle = map.get( PersisterHelper.createTupleKey( leftTuple ) ).handle;
View Full Code Here

                    }
                }
                Object abduced = aq.abduce( Arrays.copyOfRange( objects, 0, numArgs - 1 ) );
                if ( abduced != null ) {
                    EqualityKey key = ( (NamedEntryPoint) workingMemory.getEntryPoint( workingMemory.getEntryPointId() ) ).getTruthMaintenanceSystem().get( abduced );
                    InternalFactHandle handle;
                    if ( key != null ) {
                        handle = key.getFactHandle();
                        abduced = handle.getObject();
                    } else {
                        handle = (InternalFactHandle) ((InternalWorkingMemoryActions) workingMemory).insert( abduced,
                                                                                                             MODE.POSITIVE.getId(),
                                                                                                             false,
                                                                                                             true,
                                                                                                             query,
                                                                                                             (RuleTerminalNodeLeftTuple) resultLeftTuple );
                    }
                    BeliefSet bs = handle.getEqualityKey().getBeliefSet();
                    if ( bs == null ) {
                        abduced = handle.getObject();
                    } else {
                        if ( ! bs.isPositive() ) {
                            pass = false;
                        }
                    }
View Full Code Here

TOP

Related Classes of org.drools.core.common.InternalFactHandle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.