Package org.drools.factmodel.traits

Examples of org.drools.factmodel.traits.TraitProxy


                    PriorityQueue<TraitProxy> removedTypes =
                            new PriorityQueue<TraitProxy>( traitableBean._getTraitMap().values().size() );
                    removedTypes.addAll( traitableBean._getTraitMap().values() );

                    while ( ! removedTypes.isEmpty() ) {
                        TraitProxy proxy = removedTypes.poll();
                        if ( ! proxy.isVirtual() ) {
                            retract( getFactHandle( proxy ),
                                     removeLogical,
                                     updateEqualsMap,
                                     rule,
                                     activation );
View Full Code Here


    private void updateManyTraits( Object object, long mask, Collection<Thing> originators, Class<?> modifiedClass, BitSet veto, Collection<Thing> mostSpecificTraits ) {
        veto = veto != null ? (BitSet) veto.clone() : null;

        for ( Thing t : mostSpecificTraits ) {
            if ( ! originators.contains( t ) ) {
                TraitProxy proxy = (TraitProxy) t;

                proxy.setTypeFilter( veto );
                InternalFactHandle h = (InternalFactHandle) lookupFactHandle( t );
                if ( h != null ) {
                    ((InternalWorkingMemoryEntryPoint) h.getEntryPoint()).update( h,
                            t,
                            mask,
                            modifiedClass,
                            this.activation );
                }
                proxy.setTypeFilter( null );

                BitSet tc = proxy.getTypeCode();
                if ( veto == null ) {
                    veto = (BitSet) tc.clone();
                } else {
                    veto.or( tc );
                }
View Full Code Here

                    modifyPreviousTuples,
                    context.adaptModificationMaskForObjectType( objectType, workingMemory ),
                    workingMemory );
        } else {
            if ( factHandle.getObject() instanceof TraitProxy )  {
                TraitProxy proxy = ((TraitProxy) factHandle.getObject());
                BitSet vetoMask = proxy.getTypeFilter();

                if ( vetoMask == null                                                               // no vetos
                     || typeMask.isEmpty()                                                          // Thing is permissive
                     || ! HierarchyEncoderImpl.supersetOrEqualset( vetoMask, this.typeMask ) ) {    // this node is not vetoed

                    // "don" update :
                    if ( context.getModificationMask() == Long.MIN_VALUE ) {
                        // property reactivity may block trait proxies which have been asserted and then immediately updated because of another "don"
                        // however, PR must be disabled only once for each OTN: that is, a proxy will not pass an OTN if one of its ancestors can also pass it

                        // Example: given classes A <- B <-C, at OTN A, a proxy c can only pass if no proxy b exists

                        TraitableBean txBean = (TraitableBean) proxy.getObject();
                        TraitTypeMap tMap = (TraitTypeMap) txBean._getTraitMap();
                        Collection<Thing> x = tMap.immediateParents( this.typeMask );
                        Thing k = x.iterator().next();

                        long originalMask = context.getModificationMask();
View Full Code Here

                    modifyPreviousTuples,
                    context.adaptModificationMaskForObjectType( objectType, workingMemory ),
                    workingMemory );
        } else {
            if ( factHandle.getObject() instanceof TraitProxy )  {
                TraitProxy proxy = ((TraitProxy) factHandle.getObject());
                BitSet vetoMask = proxy.getTypeFilter();

                if ( vetoMask == null                                                               // no vetos
                     || typeMask.isEmpty()                                                          // Thing is permissive
                     || ! HierarchyEncoderImpl.supersetOrEqualset( vetoMask, this.typeMask ) ) {    // this node is not vetoed

                    // "don" update :
                    if ( context.getModificationMask() == Long.MIN_VALUE ) {
                        // property reactivity may block trait proxies which have been asserted and then immediately updated because of another "don"
                        // however, PR must be disabled only once for each OTN: that is, a proxy will not pass an OTN if one of its ancestors can also pass it

                        // Example: given classes A <- B <-C, at OTN A, a proxy c can only pass if no proxy b exists

                        TraitableBean txBean = (TraitableBean) proxy.getObject();
                        TraitTypeMap tMap = (TraitTypeMap) txBean._getTraitMap();
                        Collection<Key<Thing>> x = tMap.immediateParents( this.typeMask );
                        Key<Thing> k = x.iterator().next();

                        long originalMask = context.getModificationMask();
View Full Code Here

        veto = veto != null ? (BitSet) veto.clone() : null;

        for ( Key<Thing> k : mostSpecificTraits ) {
            Thing t = k.getValue();
            if ( ! originators.contains( t ) ) {
                TraitProxy proxy = (TraitProxy) t;

                proxy.setTypeFilter( veto );
                InternalFactHandle h = (InternalFactHandle) lookupFactHandle( t );
                if ( h != null ) {
                    ((InternalWorkingMemoryEntryPoint) h.getEntryPoint()).update( h,
                            t,
                            mask,
                            modifiedClass,
                            this.activation );
                }
                proxy.setTypeFilter( null );

                BitSet tc = proxy.getTypeCode();
                if ( veto == null ) {
                    veto = (BitSet) tc.clone();
                } else {
                    veto.or( tc );
                }
View Full Code Here

            veto = (BitSet) ((TraitProxy) originator).getTypeCode().clone();
        }

        for ( Thing t : px ) {
            if ( t != originator ) {
                TraitProxy proxy = (TraitProxy) t;

                proxy.setTypeFilter( veto );
                InternalFactHandle h = (InternalFactHandle) getFactHandle( t );
                ((InternalWorkingMemoryEntryPoint) h.getEntryPoint()).update( h,
                                                                              t,
                                                                              mask,
                                                                              modifiedClass,
                                                                              this.activation );
                proxy.setTypeFilter( null );

                BitSet tc = proxy.getTypeCode();
                if ( veto == null ) {
                    veto = (BitSet) tc.clone();
                } else {
                    veto.and( tc );
                }
View Full Code Here

TOP

Related Classes of org.drools.factmodel.traits.TraitProxy

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.