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