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(); }
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(); }