private void AddEventState(Cdn.Event ev) { var states = AddEventStateContainer(ev.Parent); EventStateContainerAdd(states, ev.Parent, ev.GotoState); EventStateContainerAdd(states, ev.Parent, ev.Parent.InitialState); }
private string EventConditionHolds(Cdn.Event ev, Cdn.EventLogicalNode node, EventNodeState.StateType type, Context context) { var st = EventNodeStateVariable(node, type, context); switch (node.CompareType) { case Cdn.MathFunctionType.Less: case Cdn.MathFunctionType.Greater: return(String.Format("{0} > 0", st)); case Cdn.MathFunctionType.LessOrEqual: case Cdn.MathFunctionType.GreaterOrEqual: case Cdn.MathFunctionType.And: case Cdn.MathFunctionType.Or: return(String.Format("{0} >= 0", st)); case Cdn.MathFunctionType.Equal: if (ev.Approximation != Double.MaxValue) { var approx = context.TranslateNumber(ev.Approximation); return(String.Format("{0}({1}) <= {2}", context.MathFunction(MathFunctionType.Abs, 1), st, approx)); } else { return("1"); } default: return("0"); } }
private void ScanEvent(Cdn.Event ev) { if (ev == null) { return; } d_events.Add(ev); if (!String.IsNullOrEmpty(ev.GotoState) || !String.IsNullOrEmpty(ev.Parent.InitialState)) { AddEventState(ev); } var vars = ev.SetVariables; var lst = new List <EventSetState>(); foreach (var v in vars) { lst.Add(new EventSetState(v)); } d_eventSetStates[ev] = lst; }
public EventNodeState(Cdn.Event ev, Cdn.EventLogicalNode node, StateType type) : base(node, (Cdn.Expression)(type == StateType.Current ? node.Expression : null), State.Flags.EventNode) { d_type = type; d_node = node; d_event = ev; }