Exemplo n.º 1
0
        public TransitionCondition(ICondition lcond, ICondition rcond)
        {
            if (lcond.ContainsTransitions() || rcond.ContainsTransitions())
            {
                throw new CompilerException(ErrorCode.BadCondition,
                                            "arguments to transition condition must not include transitions.");
            }

            // right hand must be a product
            var r = rcond.Decompose(ConditionMode.Static);

            if (r.Type == GateType.OR)
            {
                throw new CompilerException(ErrorCode.BadCondition,
                                            "right side of a transition must be a product.");
            }

            _rgate = r;

            var rvclist = r.GetVariableConditions().ToArray();

            var l = lcond.Decompose(ConditionMode.Static);

            // split left side into terms ...
            IEnumerable <IGate> terms = new[] { l };

            if (l.Type == GateType.OR)
            {
                terms = l.GetInputs();
            }

            // construct the transition set from the left side terms and the right side product.
            var tset = BuildTransitionSet(terms, rvclist);

            Left        = lcond;
            Right       = rcond;
            Transitions = tset;
        }
Exemplo n.º 2
0
        public TransitionCondition(ICondition lcond, ICondition rcond)
        {
            if (lcond.ContainsTransitions() || rcond.ContainsTransitions())
            {
                throw new CompilerException(ErrorCode.BadCondition,
                    "arguments to transition condition must not include transitions.");
            }

            // right hand must be a product
            var r = rcond.Decompose(ConditionMode.Static);
            if(r.Type == GateType.OR)
            {
                throw new CompilerException(ErrorCode.BadCondition,
                    "right side of a transition must be a product.");
            }

            _rgate = r;

            var rvclist = r.GetVariableConditions().ToArray();

            var l = lcond.Decompose(ConditionMode.Static);

            // split left side into terms ...
            IEnumerable<IGate> terms = new[] { l };
            if(l.Type == GateType.OR)
            {
                terms = l.GetInputs();
            }

            // construct the transition set from the left side terms and the right side product.
            var tset = BuildTransitionSet(terms, rvclist);

            Left = lcond;
            Right = rcond;
            Transitions = tset;
        }