Пример #1
0
 public VariabaleViewModel(IModelVariable model)
 {
     // Intialize the model
     this.model = model;
     // Notify the changes that occurred in the model
     model.PropertyChanged +=
         delegate(Object sender, PropertyChangedEventArgs e)
     {
         NotifyPropertyChanged("VM_" + e.PropertyName);
     };
 }
Пример #2
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            // Initialize model and view models and start the program by showing the main window
            model        = new MyModelVariable();
            Vm_navigates = new VM_navigates(model);
            Vm_dataBoard = new VM_dataBoard(model);
            Vm_map       = new VM_map(model);
            Vm_control   = new VM_control(model);
            MainWindow window = new MainWindow();

            window.Show();
        }
Пример #3
0
        private void AssertValue([NotNull] IModel sat, IModelVariable var, Value v, bool exact = true)
        {
            Assert.AreEqual(Status.SATISFIABLE, sat.Check());

            foreach (var item in  sat.Solver.Model.Consts)
            {
                var vv = sat.Solver.Model.Eval(item.Value);
                Console.WriteLine($"{item.Key.Name} = {vv}");
            }

            var a = var;

            Assert.IsNotNull(a, "variable is null");
            Assert.IsTrue(a.IsValueAvailable(), "value is unavailable (tainted)");

            Assert.AreEqual(v.Type == Yolol.Execution.Type.Number, a.CanBeNumber(), "type");
            Assert.AreEqual(v.Type == Yolol.Execution.Type.String, a.CanBeString(), "type");

            // The expected value can't possible equal all these values, so we can check if it's _not_ these values
            var aString = new Value("abc");
            var bString = new Value("cba");
            var aNum    = new Value(19);
            var bNum    = new Value(20);

            if (!v.Equals(aString))
            {
                Assert.IsFalse(a.CanBeValue(aString), "Can be string it should not be");
            }
            if (!v.Equals(bString))
            {
                Assert.IsFalse(a.CanBeValue(bString), "Can be string it should not be");
            }
            if (!v.Equals(aNum))
            {
                Assert.IsFalse(a.CanBeValue(aNum), "Can be num it should not be");
            }
            if (!v.Equals(bNum))
            {
                Assert.IsFalse(a.CanBeValue(bNum), "Can be num it should not be");
            }

            Assert.IsTrue(a.CanBeValue(v), "Can be value");

            if (exact)
            {
                Assert.IsTrue(a.IsValue(v), "Is value");
            }
        }
Пример #4
0
 public VM_dataBoard(IModelVariable model) : base(model)
 {
 }
Пример #5
0
 public VM_map(IModelVariable model) : base(model)
 {
 }
Пример #6
0
 public VM_navigates(IModelVariable model) : base(model)
 {
 }
Пример #7
0
 public VM_control(IModelVariable model) : base(model)
 {
 }