예제 #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);
        }
예제 #2
0
 private string Parenthesize(IEvaluatable construct, string argument)
 {
     if (construct.GetType() != typeof(Proposition))
     {
         return($"{_openEncapsulation}{argument}{_closeEncapsulation}");
     }
     return(argument);
 }
예제 #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);
 }
예제 #4
0
        public bool RelationallyEquivalentTo(IEvaluatable evaluatable)
        {
            if (evaluatable.GetType() != typeof(Proposition))
            {
                return(false);
            }
            var fact = evaluatable as Proposition;

            return(fact.AttributeName == AttributeName);
        }
예제 #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");
        }
예제 #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();
        }
예제 #7
0
 private static bool IsJunctionOfType <T>(IEvaluatable evaluatable)
 {
     return(evaluatable.GetType() == typeof(T));
 }