예제 #1
0
 public EvalMatchUntilNode(
     PatternAgentInstanceContext context,
     EvalMatchUntilFactoryNode factoryNode,
     EvalNode childNodeSub,
     EvalNode childNodeUntil)
     : base(context)
 {
     this.factoryNode = factoryNode;
     ChildNodeSub = childNodeSub;
     ChildNodeUntil = childNodeUntil;
 }
예제 #2
0
        public static EvalMatchUntilStateBounds InitBounds(
            EvalMatchUntilFactoryNode factoryNode,
            MatchedEventMap beginState,
            PatternAgentInstanceContext context)
        {
            int? lowerbounds = null;
            int? upperbounds = null;

            var convertor = factoryNode.OptionalConvertor;
            var eventsPerStream = convertor == null ? null : convertor.Invoke(beginState);
            if (factoryNode.SingleBound != null) {
                var bounds = (int?) factoryNode.SingleBound.Evaluate(
                    eventsPerStream,
                    true,
                    context.AgentInstanceContext);
                lowerbounds = bounds;
                upperbounds = bounds;
            }
            else {
                if (factoryNode.LowerBounds != null) {
                    lowerbounds = (int?) factoryNode.LowerBounds.Evaluate(
                        eventsPerStream,
                        true,
                        context.AgentInstanceContext);
                }

                if (factoryNode.UpperBounds != null) {
                    upperbounds = (int?) factoryNode.UpperBounds.Evaluate(
                        eventsPerStream,
                        true,
                        context.AgentInstanceContext);
                }

                if (upperbounds != null && lowerbounds != null) {
                    if (upperbounds < lowerbounds) {
                        var lbounds = lowerbounds;
                        lowerbounds = upperbounds;
                        upperbounds = lbounds;
                    }
                }
            }

            return new EvalMatchUntilStateBounds(lowerbounds, upperbounds);
        }