Ejemplo n.º 1
0
        public static ISet<MultiKeyArrayOfKeys<EventBean>> ToSingletonSetIfNotNull(MultiKeyArrayOfKeys<EventBean> row)
        {
            if (row == null) {
                return null;
            }

            return Collections.SingletonSet(row);
        }
        public UniformPair<EventBean[]> OutputJoin(bool isSynthesize)
        {
            if (outputLastIStreamBufJoin == null && outputLastRStreamBufJoin == null) {
                return null;
            }

            var pair = processor.ProcessJoinResult(
                EventBeanUtility.ToSingletonSetIfNotNull(outputLastIStreamBufJoin),
                EventBeanUtility.ToSingletonSetIfNotNull(outputLastRStreamBufJoin),
                isSynthesize);
            outputLastIStreamBufJoin = null;
            outputLastRStreamBufJoin = null;
            return pair;
        }
        public void ProcessJoin(
            ISet<MultiKeyArrayOfKeys<EventBean>> newEvents,
            ISet<MultiKeyArrayOfKeys<EventBean>> oldEvents)
        {
            if (!processor.HasHavingClause) {
                if (newEvents != null && !newEvents.IsEmpty()) {
                    outputLastIStreamBufJoin = EventBeanUtility.GetLastInSet(newEvents);
                }

                if (oldEvents != null && !oldEvents.IsEmpty()) {
                    outputLastRStreamBufJoin = EventBeanUtility.GetLastInSet(oldEvents);
                }
            }
            else {
                if (newEvents != null && newEvents.Count > 0) {
                    foreach (var theEvent in newEvents) {
                        var passesHaving = processor.EvaluateHavingClause(
                            theEvent.Array,
                            true,
                            processor.GetAgentInstanceContext());
                        if (!passesHaving) {
                            continue;
                        }

                        outputLastIStreamBufJoin = theEvent;
                    }
                }

                if (oldEvents != null && oldEvents.Count > 0) {
                    foreach (var theEvent in oldEvents) {
                        var passesHaving = processor.EvaluateHavingClause(
                            theEvent.Array,
                            false,
                            processor.GetAgentInstanceContext());
                        if (!passesHaving) {
                            continue;
                        }

                        outputLastRStreamBufJoin = theEvent;
                    }
                }
            }
        }