Esempio n. 1
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="viewFactory">for copying this view in a group-by</param>
        /// <param name="timestampExpr">the property name of the event supplying timestamp values</param>
        /// <param name="timestampEvaluator">The timestamp evaluator.</param>
        /// <param name="timeDeltaComputation">The time delta computation.</param>
        /// <param name="optionalSortedRandomAccess">is the friend class handling the random access, if required byexpressions</param>
        public TimeOrderView(
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            ViewFactory viewFactory,
            ExprNode timestampExpr,
            ExprEvaluator timestampEvaluator,
            ExprTimePeriodEvalDeltaConst timeDeltaComputation,
            IStreamSortRankRandomAccess optionalSortedRandomAccess)
        {
            _agentInstanceContext       = agentInstanceContext;
            _viewFactory                = viewFactory;
            _timestampExpression        = timestampExpr;
            _timestampEvaluator         = timestampEvaluator;
            _timeDeltaComputation       = timeDeltaComputation;
            _optionalSortedRandomAccess = optionalSortedRandomAccess;
            _scheduleSlot               = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();

            _sortedEvents = new OrderedDictionary <Object, Object>();

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = extensionServicesContext => Instrument.With(
                    i => i.QViewScheduledEval(this, _viewFactory.ViewName),
                    i => i.AViewScheduledEval(),
                    Expire)
            };

            _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback);
            agentInstanceContext.AddTerminationCallback(Stop);
        }
Esempio n. 2
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="rankWindowViewFactory">for copying this view in a group-by</param>
        /// <param name="uniqueCriteriaExpressions">The unique criteria expressions.</param>
        /// <param name="uniqueCriteriaEvaluators">The unique criteria evaluators.</param>
        /// <param name="sortCriteriaExpressions">is the event property names to sort</param>
        /// <param name="sortCriteriaEvaluators">The sort criteria evaluators.</param>
        /// <param name="descendingValues">indicates whether to sort ascending or descending for each field</param>
        /// <param name="sortWindowSize">is the window size</param>
        /// <param name="optionalRankedRandomAccess">is the friend class handling the random access, if required byexpressions</param>
        /// <param name="isSortUsingCollator">for string value sorting using compare or Collator</param>
        /// <param name="agentInstanceViewFactoryContext">The agent instance view factory context.</param>
        public RankWindowView(RankWindowViewFactory rankWindowViewFactory,
                              ExprNode[] uniqueCriteriaExpressions,
                              ExprEvaluator[] uniqueCriteriaEvaluators,
                              ExprNode[] sortCriteriaExpressions,
                              ExprEvaluator[] sortCriteriaEvaluators,
                              bool[] descendingValues,
                              int sortWindowSize,
                              IStreamSortRankRandomAccess optionalRankedRandomAccess,
                              bool isSortUsingCollator,
                              AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            _rankWindowViewFactory           = rankWindowViewFactory;
            _uniqueCriteriaExpressions       = uniqueCriteriaExpressions;
            _uniqueCriteriaEvaluators        = uniqueCriteriaEvaluators;
            _sortCriteriaExpressions         = sortCriteriaExpressions;
            _sortCriteriaEvaluators          = sortCriteriaEvaluators;
            _isDescendingValues              = descendingValues;
            _sortWindowSize                  = sortWindowSize;
            _optionalRankedRandomAccess      = optionalRankedRandomAccess;
            _agentInstanceViewFactoryContext = agentInstanceViewFactoryContext;

            _comparator        = CollectionUtil.GetComparator(sortCriteriaEvaluators, isSortUsingCollator, _isDescendingValues);
            _sortedEvents      = new OrderedDictionary <object, object>(_comparator);
            _uniqueKeySortKeys = new Dictionary <Object, Object>();
        }
Esempio n. 3
0
        public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            int sortWindowSize = ViewFactorySupport.EvaluateSizeParam(ViewName, _sizeEvaluator, agentInstanceViewFactoryContext.AgentInstanceContext);
            IStreamSortRankRandomAccess rankedRandomAccess = agentInstanceViewFactoryContext.StatementContext.ViewServicePreviousFactory.GetOptPreviousExprSortedRankedAccess(agentInstanceViewFactoryContext);

            return(new RankWindowView(this, _uniqueCriteriaExpressions, _uniqueEvals, _sortCriteriaExpressions, _sortEvals, _isDescendingValues, sortWindowSize, rankedRandomAccess, _useCollatorSort, agentInstanceViewFactoryContext));
        }
        public void SetUp()
        {
            RandomAccessByIndexObserver updateObserver = new MyRandomAccessByIndexObserver();

            _access       = new IStreamSortRankRandomAccess(updateObserver);
            _sortedEvents = new OrderedDictionary <Object, Object>(
                new MultiKeyCastingComparator(
                    new MultiKeyComparator(new bool[]
            {
                false
            })));

            _events = new EventBean[100];
            for (int i = 0; i < _events.Length; i++)
            {
                _events[i] = SupportEventBeanFactory.CreateObject(new SupportBean());
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="sortWindowViewFactory">for copying this view in a group-by</param>
        /// <param name="sortCriteriaExpressions">is the event property names to sort</param>
        /// <param name="sortCriteriaEvaluators">The sort criteria evaluators.</param>
        /// <param name="descendingValues">indicates whether to sort ascending or descending for each field</param>
        /// <param name="sortWindowSize">is the window size</param>
        /// <param name="optionalSortedRandomAccess">is the friend class handling the random access, if required byexpressions</param>
        /// <param name="isSortUsingCollator">for string value sorting using compare or Collator</param>
        /// <param name="agentInstanceViewFactoryContext">The agent instance view factory context.</param>
        public SortWindowView(SortWindowViewFactory sortWindowViewFactory,
                              ExprNode[] sortCriteriaExpressions,
                              ExprEvaluator[] sortCriteriaEvaluators,
                              bool[] descendingValues,
                              int sortWindowSize,
                              IStreamSortRankRandomAccess optionalSortedRandomAccess,
                              bool isSortUsingCollator,
                              AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            _sortWindowViewFactory          = sortWindowViewFactory;
            _sortCriteriaExpressions        = sortCriteriaExpressions;
            _sortCriteriaEvaluators         = sortCriteriaEvaluators;
            _isDescendingValues             = descendingValues;
            _sortWindowSize                 = sortWindowSize;
            _optionalSortedRandomAccess     = optionalSortedRandomAccess;
            AgentInstanceViewFactoryContext = agentInstanceViewFactoryContext;

            var comparator = CollectionUtil.GetComparator(sortCriteriaEvaluators, isSortUsingCollator, _isDescendingValues);

            _sortedEvents = new OrderedDictionary <Object, Object>(comparator);
        }
Esempio n. 6
0
 public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
 {
     IStreamSortRankRandomAccess sortedRandomAccess = agentInstanceViewFactoryContext.StatementContext.ViewServicePreviousFactory.GetOptPreviousExprSortedRankedAccess(agentInstanceViewFactoryContext);
     return new TimeOrderView(agentInstanceViewFactoryContext, this, _timestampExpression, _timestampExpressionEvaluator, ExprTimePeriodEvalDeltaConstZero.INSTANCE, sortedRandomAccess);
 }