Example #1
0
        public bool RelationallyEquivalentTo(IEvaluatable evaluatable)
        {
            if (evaluatable.GetType() != typeof(Disjunction))
            {
                return(false);
            }
            var scenario = evaluatable as Disjunction;

            foreach (var arg in Arguments)
            {
                if (!ScenarioContainsArgumentRelation(scenario.Arguments, arg))
                {
                    return(false);
                }
            }

            foreach (var arg in scenario.Arguments)
            {
                if (!ScenarioContainsArgumentRelation(Arguments, arg))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
 private string Parenthesize(IEvaluatable construct, string argument)
 {
     if (construct.GetType() != typeof(Proposition))
     {
         return($"{_openEncapsulation}{argument}{_closeEncapsulation}");
     }
     return(argument);
 }
Example #3
0
 public bool RelationallyEquivalentTo(IEvaluatable evaluatable)
 {
     if (evaluatable.GetType() == typeof(Implication))
     {
         var implication = evaluatable as Implication;
         return(Antecedent.RelationallyEquivalentTo(implication.Antecedent) && Consequent.RelationallyEquivalentTo(implication.Consequent));
     }
     return(false);
 }
Example #4
0
        public bool RelationallyEquivalentTo(IEvaluatable evaluatable)
        {
            if (evaluatable.GetType() != typeof(Proposition))
            {
                return(false);
            }
            var fact = evaluatable as Proposition;

            return(fact.AttributeName == AttributeName);
        }
Example #5
0
        private bool EvaluateAgainst <World>(IEvaluatable evaluatable, World world)
        {
            switch (evaluatable.GetType().Name)
            {
            case nameof(Conjunction):
                return(EvaluateConjunction(evaluatable as Conjunction, world));

            case nameof(Implication):
                return(EvaluateImplication(evaluatable as Implication, world));

            case nameof(Disjunction):
                return(EvaluateDisjunction(evaluatable as Disjunction, world));

            case nameof(Proposition):
                return(EvaluateProposition(evaluatable as Proposition, world));
            }
            throw new Exception("Unknown construct");
        }
Example #6
0
        public string DymeConstructToFormattedString(IEvaluatable construct)
        {
            var constructType = construct.GetType().Name.ToString();

            switch (constructType)
            {
            case nameof(Proposition):
                return(FactToEasyRuleFormat(construct));

            case nameof(Conjunction):
                return(ConjunctionToEasyRuleFormat(construct));

            case nameof(Disjunction):
                return(DisjunctionToEasyRuleFormat(construct));

            case nameof(Implication):
                return(ImplyToEasyRuleFormat(construct));
            }
            throw new ArgumentOutOfRangeException();
        }
Example #7
0
 private static bool IsJunctionOfType <T>(IEvaluatable evaluatable)
 {
     return(evaluatable.GetType() == typeof(T));
 }