public override bool Equals(object obj)
        {
            if (obj is Antecedent)
            {
                Antecedent antecedent = obj as Antecedent;

                foreach (Judgment currentJudgment in this.JudgmentList)
                {
                    Boolean hasJudgment = false;

                    foreach (Judgment judgment in antecedent.JudgmentList)
                    {
                        if (currentJudgment.Equals(judgment))
                        {
                            hasJudgment = true;
                            break;
                        }
                    }

                    if (!hasJudgment)
                    {
                        return(false);
                    }
                }

                return(true);
            }
            else
            {
                throw new ArgumentException();
            }
        }
Ejemplo n.º 2
0
        private Rule GetRule18()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new Judgment(FactorName.AmbientTemperature, EvaluationValue.Normal));
            consequent = new Consequent(new Judgment(FactorName.Generator, EvaluationValue.CheckAmbientTemperature));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 3
0
        private Rule GetRule9()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new Judgment(FactorName.OilInCan, EvaluationValue.AddOilInCan));
            consequent = new Consequent(new Judgment(FactorName.OilInCan, EvaluationValue.NotEmpty));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 4
0
        private Rule GetRule17()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new Judgment(FactorName.Heater, EvaluationValue.SwitchOff));
            consequent = new Consequent(new Judgment(FactorName.AmbientTemperature, EvaluationValue.Normal));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 5
0
        private Rule GetRule12()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new Judgment(FactorName.FuelInTank, EvaluationValue.AddFuelInTank));
            consequent = new Consequent(new Judgment(FactorName.FuelInTank, EvaluationValue.NotEmpty));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 6
0
        private Rule GetRule8()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new Judgment(FactorName.FlapPosition, EvaluationValue.CloseFlap));
            consequent = new Consequent(new Judgment(FactorName.FlapPosition, EvaluationValue.Close));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 7
0
        private Rule GetRule7()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new Judgment(FactorName.ConnectedDevices, EvaluationValue.DisconnectDevices));
            consequent = new Consequent(new Judgment(FactorName.ConnectedDevices, EvaluationValue.Empty));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 8
0
        private Rule GetRule1()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new List <Judgment> {
                new Judgment(FactorName.OilInTank, EvaluationValue.Empty),
                new Judgment(FactorName.OilInCan, EvaluationValue.Empty)
            });
            consequent = new Consequent(new Judgment(FactorName.OilInCan, EvaluationValue.AddOilInCan));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 9
0
        private Rule GetRule13()
        {
            Antecedent antecedent;
            Consequent consequent;

            antecedent = new Antecedent(new List <Judgment> {
                new Judgment(FactorName.OilInTank, EvaluationValue.NotEmpty),
                new Judgment(FactorName.FuelInTank, EvaluationValue.NotEmpty),
                new Judgment(FactorName.ConnectedDevices, EvaluationValue.Empty),
                new Judgment(FactorName.FlapPosition, EvaluationValue.Close)
            });
            consequent = new Consequent(new Judgment(FactorName.Generator, EvaluationValue.Done));

            return(new SimpleRule(antecedent, consequent));
        }
Ejemplo n.º 10
0
 public CompoundRule(Antecedent antecedent, Consequent consequent) : base(antecedent, consequent)
 {
     this.childRules = new List <Rule>();
 }
 public SimpleRule(Antecedent antecedent, Consequent consequent) : base(antecedent, consequent)
 {
 }
Ejemplo n.º 12
0
 public Rule(Antecedent antecedent, Consequent consequent)
 {
     this.antecedent = antecedent;
     this.consequent = consequent;
 }