public CorrectValueRule Build()
        {
            var tokens = State.ExposeValueTokens(out var topOps);

            CorrectValueRule result;

            if (topOps == ConditionOps.Break)
            {
                result = new CorrectValueRule()
                {
                    MemberName = MemberName,
                    Contract   = _contract,
                    Mode       = Mode,
                    Tokens     = tokens
                };
            }
            else
            {
                result = new LogicCorrectValueRule()
                {
                    MemberName    = MemberName,
                    Contract      = _contract,
                    Mode          = Mode,
                    Tokens        = tokens,
                    InternalLogic = topOps != ConditionOps.Or
                };
            }

            return(result);
        }
        public virtual void Merge(CorrectValueRule rule)
        {
            if (rule is null)
            {
                return;
            }

            if (MemberName != rule.MemberName)
            {
                return;
            }

            if (rule.Mode != CorrectValueRuleMode.Append)
            {
                return;
            }

            foreach (var token in rule.Tokens)
            {
                if (token.MutuallyExclusive)
                {
                    continue;
                }

                if (!TokenMutexCalculator.Available(Tokens, token))
                {
                    continue;
                }

                Tokens.Add(token);
            }
        }
Exemple #3
0
 public override void Merge(CorrectValueRule rule)
 {
     if (rule is LogicCorrectValueRule logicRule && InternalLogic != logicRule.InternalLogic)
     {
         return;
     }
     base.Merge(rule);
 }