protected void AddEvent(
            EventBean theEvent,
            EventBean[] eventsPerStream,
            ExprEvaluatorContext exprEvaluatorContext)
        {
            Object comparable = AggregationStateSortedImpl.GetComparable(
                Spec.Criteria, eventsPerStream, true, exprEvaluatorContext);

            if (CurrentMinMax == null)
            {
                CurrentMinMax     = comparable;
                CurrentMinMaxBean = theEvent;
            }
            else
            {
                int compareResult = Spec.Comparator.Compare(CurrentMinMax, comparable);
                if (Spec.IsMax)
                {
                    if (compareResult < 0)
                    {
                        CurrentMinMax     = comparable;
                        CurrentMinMaxBean = theEvent;
                    }
                }
                else
                {
                    if (compareResult > 0)
                    {
                        CurrentMinMax     = comparable;
                        CurrentMinMaxBean = theEvent;
                    }
                }
            }
        }
Esempio n. 2
0
        public void ApplyEnter(EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext)
        {
            EventBean theEvent = eventsPerStream[Spec.StreamId];

            if (theEvent == null)
            {
                return;
            }
            Object comparable = AggregationStateSortedImpl.GetComparable(
                Spec.Criteria, eventsPerStream, true, exprEvaluatorContext);

            if (CurrentMinMax == null)
            {
                CurrentMinMax     = comparable;
                CurrentMinMaxBean = theEvent;
            }
            else
            {
                int compareResult = Spec.Comparator.Compare(CurrentMinMax, comparable);
                if (Spec.IsMax)
                {
                    if (compareResult < 0)
                    {
                        CurrentMinMax     = comparable;
                        CurrentMinMaxBean = theEvent;
                    }
                }
                else
                {
                    if (compareResult > 0)
                    {
                        CurrentMinMax     = comparable;
                        CurrentMinMaxBean = theEvent;
                    }
                }
            }
        }