示例#1
0
 public EvalMatchUntilNode(PatternAgentInstanceContext context, EvalMatchUntilFactoryNode factoryNode, EvalNode childNodeSub, EvalNode childNodeUntil)
     : base(context)
 {
     FactoryNode    = factoryNode;
     ChildNodeSub   = childNodeSub;
     ChildNodeUntil = childNodeUntil;
 }
        public static EvalMatchUntilStateBounds InitBounds(
            EvalMatchUntilFactoryNode factoryNode,
            MatchedEventMap beginState,
            PatternAgentInstanceContext context)
        {
            int?lowerbounds     = null;
            int?upperbounds     = null;
            var eventsPerStream = factoryNode.Convertor.Convert(beginState);
            var evaluateParams  = new EvaluateParams(eventsPerStream, true, context.AgentInstanceContext);

            if (factoryNode.SingleBound != null)
            {
                var bounds = (int?)factoryNode.SingleBound.ExprEvaluator.Evaluate(evaluateParams);
                lowerbounds = bounds;
                upperbounds = bounds;
            }
            else
            {
                if (factoryNode.LowerBounds != null)
                {
                    lowerbounds = (int?)factoryNode.LowerBounds.ExprEvaluator.Evaluate(evaluateParams);
                }
                if (factoryNode.UpperBounds != null)
                {
                    upperbounds = (int?)factoryNode.UpperBounds.ExprEvaluator.Evaluate(evaluateParams);
                }
                if (upperbounds != null && lowerbounds != null)
                {
                    if (upperbounds < lowerbounds)
                    {
                        int?lbounds = lowerbounds;
                        lowerbounds = upperbounds;
                        upperbounds = lbounds;
                    }
                }
            }

            return(new EvalMatchUntilStateBounds(lowerbounds, upperbounds));
        }