Beispiel #1
0
        private Node CreateActionNodeOfT <T>(JoinNode <T> joinNode, Expression <Action <RuleContext <T> > > expression)
        {
            var actionNode = new ActionNode <T>(expression);

            joinNode.AddSuccessor(actionNode);

            return(actionNode);
        }
Beispiel #2
0
        protected bool Visit <T>(JoinNode <T> node)
        {
            _lastNodeVertex = GetSink(node.GetHashCode(), () => "J", typeof(JoinNode <>), typeof(T));

            if (_vertices.ContainsKey(node.RightActivation.GetHashCode()))
            {
                Vertex sink = _vertices[node.RightActivation.GetHashCode()];

                _edges.Add(new Edge(sink, _lastNodeVertex, _lastNodeVertex.TargetType.Name));
            }

            if (_stack.Count > 0)
            {
                _edges.Add(new Edge(_stack.Peek(), _lastNodeVertex, _lastNodeVertex.TargetType.Name));
            }

            return(true);
        }
Beispiel #3
0
        private static JoinNode <T> GetFinalJunction <T>(IEnumerable <AlphaNode <T> > nodes)
        {
            JoinNode <T> junction;

            if (nodes.Count() == 1)
            {
                junction = nodes.Single().GetConstantJoinNode();
            }
            else if (nodes.Count() == 2)
            {
                junction = nodes.Skip(1).First().GetAlphaJoinNode(nodes.First());
            }
            else
            {
                junction = new JoinNode <T>(nodes.First());
                GetFinalJunction(nodes.Skip(1)).AddSuccessor(junction);
            }

            return(junction);
        }
Beispiel #4
0
        private Node CreateActionNodeOfT <T>(JoinNode <T> joinNode, Expression <Action> expression)
        {
            Expression <Action <RuleContext <T> > > action = expression.WrapActionWithArgument <RuleContext <T> >();

            return(CreateActionNodeOfT(joinNode, action));
        }
Beispiel #5
0
        protected bool Visit <T>(JoinNode <T> node)
        {
            Append("Junction<{0}>[{1}]", typeof(T).Name, node.GetHashCode());

            return(true);
        }