Exemplo n.º 1
0
            public OR(SemanticContext a, SemanticContext b)
            {
                HashSet <SemanticContext> operands = new HashSet <SemanticContext>();

                if (a is SemanticContext.OR)
                {
                    operands.UnionWith(((OR)a).opnds);
                }
                else
                {
                    operands.Add(a);
                }
                if (b is SemanticContext.OR)
                {
                    operands.UnionWith(((OR)b).opnds);
                }
                else
                {
                    operands.Add(b);
                }
                IList <SemanticContext.PrecedencePredicate> precedencePredicates = FilterPrecedencePredicates(operands);

                if (precedencePredicates.Count > 0)
                {
                    // interested in the transition with the highest precedence
                    SemanticContext.PrecedencePredicate reduced = precedencePredicates.Max();
                    operands.Add(reduced);
                }
                this.opnds = operands.ToArray();
            }
Exemplo n.º 2
0
            public AND([NotNull] SemanticContext a, [NotNull] SemanticContext b)
            {
                HashSet <SemanticContext> operands = new HashSet <SemanticContext>();

                if (a is SemanticContext.AND)
                {
                    operands.UnionWith(((AND)a).opnds);
                }
                else
                {
                    operands.Add(a);
                }
                if (b is SemanticContext.AND)
                {
                    operands.UnionWith(((AND)b).opnds);
                }
                else
                {
                    operands.Add(b);
                }
                IList <SemanticContext.PrecedencePredicate> precedencePredicates = FilterPrecedencePredicates(operands);

                if (precedencePredicates.Count > 0)
                {
                    // interested in the transition with the lowest precedence
                    SemanticContext.PrecedencePredicate reduced = precedencePredicates.Min();
                    operands.Add(reduced);
                }
                opnds = operands.ToArray();
            }