Example #1
0
        static void fOL_Demodulation()
        {
            System.Console.WriteLine("-----------------");
            System.Console.WriteLine("Demodulation Demo");
            System.Console.WriteLine("-----------------");
            FOLDomain domain = new FOLDomain();

            domain.addConstant("A");
            domain.addConstant("B");
            domain.addConstant("C");
            domain.addConstant("D");
            domain.addConstant("E");
            domain.addPredicate("P");
            domain.addFunction("F");
            domain.addFunction("G");
            domain.addFunction("H");
            domain.addFunction("J");

            FOLParser parser = new FOLParser(domain);

            Predicate    expression = (Predicate)parser.parse("P(A,F(B,G(A,H(B)),C),D)");
            TermEquality assertion  = (TermEquality)parser.parse("B = E");

            Demodulation demodulation  = new Demodulation();
            Predicate    altExpression = (Predicate)demodulation.apply(assertion, expression);

            System.Console.WriteLine("Demodulate '" + expression + "' with '" + assertion + "' to give");
            System.Console.WriteLine(altExpression.ToString());
            System.Console.WriteLine("and again to give");
            System.Console.WriteLine(demodulation.apply(assertion, altExpression).ToString());
            System.Console.WriteLine("");
        }
Example #2
0
        public double Demodulate(Demodulation demodulation)
        {
            if (demodulation.Value < 10000)
            {
                demodulation.Demodulator = new NoizyDemodulator();
                demodulation.Value       = demodulation.Demodulator.Demodulate(demodulation);
                return(demodulation.Value);
            }

            demodulation.Value = demodulation.Value * 2;
            return(demodulation.Value);
        }
Example #3
0
        public void SimpleDemodulator_Demodulate_ValueLessThanLimitValueAndNoizyDemodulator__ReturnsValueModifiedBySimpleDemodulatorLogic()
        {
            var value          = TestData.DemodulationHandlerLimit - 100;
            var expectedResult = TestData.SimpleDemodulationHandlerLogic(value);

            var demodulation = new Demodulation
            {
                Value       = value,
                Demodulator = new NoizyDemodulator()
            };

            var actualResult = _simpleDemodulator.Demodulate(demodulation);

            Assert.Equal(expectedResult, actualResult);
        }
Example #4
0
 public void setUp()
 {
     demodulation = new Demodulation();
 }
Example #5
0
 public ChainOfResponsibilityTests()
 {
     _demodulation = Demodulation.GetInstance;
 }