Package org.drools.common

Examples of org.drools.common.EventFactHandle


                                                     _handle.getId(),
                                                     _handle.getRecency() );
                break;
            }
            case EVENT : {
                handle = new EventFactHandle( _handle.getId(),
                                              object,
                                              _handle.getRecency(),
                                              _handle.getTimestamp(),
                                              _handle.getDuration(),
                                              entryPoint );
View Full Code Here


                              final InternalFactHandle handle,
                              final InternalWorkingMemory workingMemory) {
        SlidingLengthWindowContext window = (SlidingLengthWindowContext) context;
        window.pos = (window.pos + 1) % window.handles.length;
        if ( window.handles[window.pos] != null ) {
            final EventFactHandle previous = window.handles[window.pos];
            // retract previous
            if ( ! previous.isExpired() ) {
                final PropagationContext propagationContext = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(),
                                                                                          PropagationContext.EXPIRATION,
                                                                                          null,
                                                                                          null,
                                                                                          previous );
View Full Code Here

    public boolean assertFact(final WindowMemory memory,
                              final Object context,
                              final InternalFactHandle fact,
                              final InternalWorkingMemory workingMemory) {
        final SlidingTimeWindowContext queue = (SlidingTimeWindowContext) context;
        final EventFactHandle handle = (EventFactHandle) fact;
        long currentTime = workingMemory.getTimerService().getCurrentTime();
        if ( isExpired( currentTime, handle ) ) {
            return false;
        }
        queue.lock.lock();
View Full Code Here

    public void retractFact(final WindowMemory memory,
                            final Object context,
                            final InternalFactHandle fact,
                            final InternalWorkingMemory workingMemory) {
        final SlidingTimeWindowContext queue = (SlidingTimeWindowContext) context;
        final EventFactHandle handle = (EventFactHandle) fact;
        // it may be a call back to expire the tuple that is already being expired
        queue.lock.lock();
            if ( queue.expiringHandle != handle ) {
                if ( queue.queue.peek() == handle ) {
                    // it was the head of the queue
View Full Code Here

                            final InternalWorkingMemory workingMemory) {
        TimerService clock = workingMemory.getTimerService();
        long currentTime = clock.getCurrentTime();
        SlidingTimeWindowContext queue = (SlidingTimeWindowContext) context;
        queue.lock.lock();
            EventFactHandle handle = queue.queue.peek();
            while ( handle != null && isExpired( currentTime,
                                                 handle ) ) {
                queue.expiringHandle = handle;
                queue.queue.remove();
                if( handle.isValid() ) {
                    // if not expired yet, expire it
                    final PropagationContext propagationContext = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(),
                                                                                              PropagationContext.EXPIRATION,
                                                                                              null,
                                                                                              null,
View Full Code Here

            BehaviorJobContext bjobCtx = ( BehaviorJobContext ) jobCtx;
           
            // write out SlidingTimeWindowContext
            SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) bjobCtx.behaviorContext;
 
            EventFactHandle handle = slCtx.getQueue().peek();
            outputCtx.writeInt( handle.getId() );
           
//            BetaNode node = (BetaNode) handle.getRightTupleSink();
//            outputCtx.writeInt( node.getId() );
//           
//            Behavior[] behaviors = node.getBehaviors();
View Full Code Here

            // BehaviorJob, no state           
            BehaviorJobContext bjobCtx = ( BehaviorJobContext ) jobCtx;
            // write out SlidingTimeWindowContext
            SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) bjobCtx.behaviorContext;
 
            EventFactHandle handle = slCtx.getQueue().peek();
           
            return ProtobufMessages.Timers.Timer.newBuilder()
                    .setType( ProtobufMessages.Timers.TimerType.BEHAVIOR )
                    .setBehavior( ProtobufMessages.Timers.BehaviorTimer.newBuilder()
                                  .setHandleId( handle.getId() )
                                  .build() )
                    .build();
        }
View Full Code Here

    public Trigger createTrigger( Activation item, WorkingMemory wm ) {
        long timestamp;
        if (eventFactHandleDecl != null) {
            LeftTuple leftTuple = item.getTuple();
            EventFactHandle  fh = (EventFactHandle) leftTuple.get(eventFactHandleDecl);
            timestamp = fh.getStartTimestamp();
        } else {
            timestamp = ((InternalWorkingMemory)wm).getTimerService().getCurrentTime();
        }
        String[] calendarNames = item.getRule().getCalendars();
        Calendars calendars = ((InternalWorkingMemory) wm).getCalendars();
View Full Code Here

            outputCtx.writeShort( WorkingMemoryAction.WorkingMemoryBehahviourRetract );

            // write out SlidingTimeWindowContext
            SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) context;

            EventFactHandle handle = slCtx.getQueue().peek();
            outputCtx.writeInt( handle.getId() );
        }
View Full Code Here

        _handle.setRecency(handle.getRecency());
        _handle.setEntryPoint( handle.getEntryPoint().getEntryPointId() );

        if (_handle.getType() == ProtobufMessages.FactHandle.HandleType.EVENT) {
            // is event
            EventFactHandle efh = (EventFactHandle) handle;
            _handle.setTimestamp(efh.getStartTimestamp());
            _handle.setDuration(efh.getDuration());
            _handle.setIsExpired(efh.isExpired());
            _handle.setActivationsCount(efh.getActivationsCount());
        }

        Object object = handle.getObject();

        if (object != null) {
View Full Code Here

TOP

Related Classes of org.drools.common.EventFactHandle

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.