Esempio n. 1
0
        private void ExtractEventStates()
        {
            Queue <EventNode> states = new Queue <EventNode>();

            foreach (var ev in d_events)
            {
                var n = new EventNode {
                    Event = ev,
                    Node  = ev.LogicalTree
                };

                states.Enqueue(n);
            }

            // Expand nodes
            while (states.Count > 0)
            {
                var n = states.Dequeue();

                // Add three states for each node to hold the
                // 1) previous value of the event equation
                // 2) current value of the event equation
                // 3) distance value of the event equation
                AddEventNodeState(new EventNodeState(n.Event, n.Node, EventNodeState.StateType.Previous));

                var current = new EventNodeState(n.Event, n.Node, EventNodeState.StateType.Current);
                AddEventNodeState(current);

                if (n.Node.Expression != null)
                {
                    d_eventEquationStates.Add(current);
                }

                AddEventNodeState(new EventNodeState(n.Event, n.Node, EventNodeState.StateType.Distance));

                if (n.Node.Left != null)
                {
                    states.Enqueue(new EventNode {
                        Event = n.Event, Node = n.Node.Left
                    });
                }

                if (n.Node.Right != null)
                {
                    states.Enqueue(new EventNode {
                        Event = n.Event, Node = n.Node.Right
                    });
                }
            }
        }
Esempio n. 2
0
 private void AddEventNodeState(EventNodeState s)
 {
     AddState(null, s);
     d_eventNodeStates.Add(s);
 }