Ejemplo n.º 1
0
 public override void Exit(Stove entity, Mom mom)
 {
     entity.currentState.text += "\n" + "Finish Cooking";
     entity.food.isCooked      = true;
     mom.AddActivity(new OccupiedState(entity.exitTime, entity.priority, 4, "Taking food out"));
 }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public bool IsEqual()
 {
     return(Mom.Equals(Dad));
 }
Ejemplo n.º 3
0
 public override void Enter(Stove entity, Mom mom)
 {
     this.time = entity.food.time;
     entity.currentState.text += "\n" + "Cooking";
 }
Ejemplo n.º 4
0
 public override void Exit(Child entity, Mom mom)
 {
     entity.currentState.text += "\n" + "Finish Shopping";
     entity.BuyFood();
     mom.AddActivity(new OccupiedState(entity.exitTime, entity.priority, 3, "Receiving child"));
 }
Ejemplo n.º 5
0
 public MomViewModel()
 {
     _timer.Interval = 2000;
     _timer.Elapsed += (s, e) => Selected = new Mom();
     _timer.Start();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Calculates the indicator value(s) at the current index.
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBar == 0)
            {
                fastEma.Set(Input[0]);
                slowEma.Set(Input[0]);
                Value.Set(0);
                Avg.Set(0);
                Diff.Set(0);
            }
            else
            {
                upDown = 0;
                fastEma.Set((2.0 / (1 + Fast)) * Input[0] + (1 - (2.0 / (1 + Fast))) * fastEma[1]);
                slowEma.Set((2.0 / (1 + Slow)) * Input[0] + (1 - (2.0 / (1 + Slow))) * slowEma[1]);

                double macd    = fastEma[0] - slowEma[0];
                double macdAvg = (2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1];

                Value.Set(macd);
                Avg.Set(macdAvg);
                //Diff.Set(macd - macdAvg);
                Diff.Set(macd);

                if (Math.Abs(Value[0]) > Math.Abs(Value[1]))
                {
                    PlotColors[0][0] = Color.Green;
                    upDown++;
                }
                else
                {
                    PlotColors[0][0] = Color.Red;
                    upDown--;
                }

                if (Rising(Avg))
                {
                    PlotColors[1][0] = Color.Green;
                    upDown++;
                }
                else
                {
                    PlotColors[1][0] = Color.Red;
                    upDown--;
                }
                // Sets the bar color to its default color as defined in the chart properties dialog
                //BarColor = Color.Empty;
                //CandleOutlineColorSeries[0] = Color.Black;
                //CandleOutlineColor = Color.Black;
                if (macd > 0 && macd > macdAvg)
                {
                    BarColor = Color.Green;
                }
                else if (macd < 0 && macd < macdAvg)
                {
                    BarColor = Color.Red;
                }
                else
                {
                    BarColor = Color.Black;
                }


                Mom.Set(macd);
            }
        }
Ejemplo n.º 7
0
 public override void Enter(Child entity, Mom mom)
 {
     this.time = entity.time;
     entity.currentState.text += "\n" + "Shopping";
 }
Ejemplo n.º 8
0
 // action to execute when enter the state
 public abstract void Enter(T entity, Mom mom);
Ejemplo n.º 9
0
 // execute when exit from state
 public abstract void Exit(T entity, Mom mom);
Ejemplo n.º 10
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            // Dads Seeeding
            var dad1 = new Dad()
            {
                Id = 1, Name = "Juan Robles"
            };
            var dad2 = new Dad()
            {
                Id = 2, Name = "Rodrigo Lopez"
            };

            modelBuilder.Entity <Dad>().HasData(new Dad[] { dad1, dad2 });

            // Moms Sedding
            Mom mom1 = new Mom()
            {
                Id = 1, Name = "Maria Stink"
            };
            Mom mom2 = new Mom()
            {
                Id = 2, Name = "Romina Tumbado"
            };

            modelBuilder.Entity <Mom>().HasData(new Mom[] { mom1, mom2 });

            // Student Sedding
            Student student1 = new Student()
            {
                Id = 1, Name = "Mario Robles Stink", DadId = 1, MomId = 1
            };
            Student student2 = new Student()
            {
                Id = 2, Name = "Erick Lopez Tumbado", DadId = 2, MomId = 2
            };
            Student student3 = new Student()
            {
                Id = 3, Name = "Martin Lopez Tumbado", DadId = 2, MomId = 2
            };

            modelBuilder.Entity <Student>().HasData(new Student[] { student1, student2, student3 });

            // School Sedding
            School school1 = new School()
            {
                Id = 1, Name = "Instituto Kipling", StudentId = 1
            };
            School school2 = new School()
            {
                Id = 2, Name = "Instituto Benavente", StudentId = 2
            };
            School school3 = new School()
            {
                Id = 3, Name = "Instituto Capistrano", StudentId = 2
            };
            School school4 = new School()
            {
                Id = 4, Name = "Instituto Capistrano", StudentId = 3
            };

            modelBuilder.Entity <School>().HasData(new School[] { school1, school2, school3, school4 });
        }
Ejemplo n.º 11
0
 public override void Exit(Washer entity, Mom mom)
 {
     entity.currentState.text += "\n" + "Finish Washing";
     mom.AddActivity(new OccupiedState(entity.exitTime, entity.priority, "Unloading washer"));
 }
Ejemplo n.º 12
0
 public override void Enter(Washer entity, Mom mom)
 {
     this.time = entity.time / entity.cycle;
     entity.currentState.text += "\n" + "Washing";
 }
Ejemplo n.º 13
0
 private void Mom_pressed(object sender, TappedRoutedEventArgs e)
 {
     Mom.Play();
 }
Ejemplo n.º 14
0
        protected override void OnBarUpdate()
        {
            Squeeze.Set(0);
            switch (_sStyle)
            {
            case SqueezeStyle.BBSqueeze:
            {
                double avtrrg = ATR(_length)[0];
                double sd     = StdDev(Close, _length)[0];
                double bbsInd = (_nK * avtrrg) != 0 ? _nBb * sd / (_nK * avtrrg) : 1;
                PlotColors[0][0] = bbsInd <= 1 ? _alertcolor : _normalcolor;
                _myValue2.Set(Input[0] - (((DonchianChannel(Input, _mLength).Mean.Get(CurrentBar)) + (EMA(Input, _mLength)[0])) / 2));
                Mom.Set(LinReg(_myValue2, _mLength)[0]);
                if (CurrentBar > 0)
                {
                    PlotColors[1][0] = Mom[0] > 0 ? (Mom[0] > Mom[1] ? _pmup : _pmdown) : (Mom[0] > Mom[1] ? _nmup : _nmdown);
                }
            }
            break;

            case SqueezeStyle.PBFSqueeze:
                if (CurrentBar == 0)
                {
                    _myValue2.Set(Close[0]);
                }
                else
                {
                    _myValue2.Set(RGaussianFilter(Typical, _gaussperiod, _gausspoles)[0]);
                    PlotColors[0][0] = _myValue2[0] <= _myValue2[1] ? _pbfsell : _pbfbuy;
                    _fv1             = RGaussianFilter(Typical, 8, 4)[0];
                    _sv1             = RGaussianFilter(Typical, 21, 4)[0];
                    _d1  = _fv1 - _sv1;
                    _fv2 = RGaussianFilter(Typical, 13, 4)[0];
                    _sv2 = RGaussianFilter(Typical, 34, 4)[0];
                    _d2  = _fv2 - _sv2;
                    _fv3 = RGaussianFilter(Typical, 21, 4)[0];
                    _sv3 = RGaussianFilter(Typical, 55, 4)[0];
                    _d3  = _fv3 - _sv3;
                    _fv4 = RGaussianFilter(Typical, 34, 4)[0];
                    _sv4 = RGaussianFilter(Typical, 89, 4)[0];
                    _d4  = _fv4 - _sv4;
                    Mom.Set((_d1 + _d2 + _d3 + _d4) / 4);
                    PlotColors[1][0] = Mom[0] > 0 ? (Mom[0] > Mom[1] ? _pmup : _pmdown) : (Mom[0] > Mom[1] ? _nmup : _nmdown);
                }
                break;

            default:
                if (CurrentBar == 0)
                {
                    _myValue2.Set(Close[0]);
                }
                else
                {
                    _myValue2.Set(RGaussianFilter(Typical, _gaussperiod, _gausspoles)[0]);
                    PlotColors[0][0] = _myValue2[0] <= _myValue2[1] ? _pbfsell : _pbfbuy;
                    _fv1             = RGaussianFilter(Typical, 8, _gausspolescounter)[0];
                    _sv1             = RGaussianFilter(Typical, 21, _gausspolescounter)[0];
                    _d1  = _fv1 - _sv1;
                    _fv2 = RGaussianFilter(Typical, 13, _gausspolescounter)[0];
                    _sv2 = RGaussianFilter(Typical, 34, _gausspolescounter)[0];
                    _d2  = _fv2 - _sv2;
                    _fv3 = RGaussianFilter(Typical, 21, _gausspolescounter)[0];
                    _sv3 = RGaussianFilter(Typical, 55, _gausspolescounter)[0];
                    _d3  = _fv3 - _sv3;
                    _fv4 = RGaussianFilter(Typical, 34, _gausspolescounter)[0];
                    _sv4 = RGaussianFilter(Typical, 89, _gausspolescounter)[0];
                    _d4  = _fv4 - _sv4;
                    Mom.Set((_d1 + _d2 + _d3 + _d4) / 4);

                    PlotColors[1][0] = Mom[0] > 0 ? (Mom[0] > Mom[1] ? _pmup : _pmdown) : (Mom[0] > Mom[1] ? _nmup : _nmdown);

                    if (CCI(_cciperiod)[1] > 50 && CCI(_cciperiod)[0] <= 50 && Mom[0] > 0 && Mom[1] > 0 && Mom[2] > 0)
                    {
                        PlotColors[1][0] = _nmup;
                        _downct          = 1;
                    }

                    if (_downct == 1 && Mom[0] > 0 && CCI(_cciperiod)[0] < 100)
                    {
                        PlotColors[1][0] = _nmup;
                    }

                    if (_downct == 1 && CCI(_cciperiod)[1] < 100 && CCI(_cciperiod)[0] > 100)
                    {
                        PlotColors[1][0] = _pmup;
                        _downct          = 0;
                    }

                    if (_downct == 1 && Mom[0] < 0)
                    {
                        _downct = 0;
                    }

                    if (CCI(_cciperiod)[1] < -50 && CCI(_cciperiod)[0] > -50 && Mom[0] < 0 && Mom[1] < 0 && Mom[2] < 0)
                    {
                        PlotColors[1][0] = _pmdown;
                        _upct            = 1;
                    }

                    if (_upct == 1 && Mom[0] > 0)
                    {
                        _upct = 0;
                    }

                    if (_upct == 1 && Mom[0] < 0 && CCI(_cciperiod)[0] > -100)
                    {
                        PlotColors[1][0] = _pmdown;
                    }

                    if (_upct == 1 && CCI(_cciperiod)[1] > -100 && CCI(_cciperiod)[0] < -100)
                    {
                        PlotColors[1][0] = _nmdown;
                        _upct            = 0;
                    }
                }
                break;
            }
        }