public static void Refresh()
        {
            var db = DB.NewContext();

            ProfileMaintainer.ComputeDayWeights();
            DCC.Refresh(db);
            AxesBuilder.UpdateOrigin(db);
            ProfileMaintainer.Refresh(db);
        }
        public static void Persist()
        {
            var db = DB.NewContext();

            DCC.Persist(db);

            AxesBuilder.Persist(db);
            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {
                foreach (var h in db.ClusterHistories)
                {
                    if (double.IsNaN(h.F))
                    {
                        System.Windows.Forms.MessageBox.Show("F");
                    }
                    else if (double.IsNaN(h.W))
                    {
                        System.Windows.Forms.MessageBox.Show("W");
                    }
                    else if (double.IsNaN(h.T))
                    {
                        System.Windows.Forms.MessageBox.Show("T");
                    }
                    else if (double.IsInfinity(h.F))
                    {
                        System.Windows.Forms.MessageBox.Show("F");
                    }
                    else if (double.IsInfinity(h.W))
                    {
                        System.Windows.Forms.MessageBox.Show("W");
                    }
                    else if (double.IsInfinity(h.T))
                    {
                        System.Windows.Forms.MessageBox.Show("T");
                    }
                }
                foreach (var h in db.GroupRateHistories)
                {
                    if (double.IsNaN(h.Rate))
                    {
                        System.Windows.Forms.MessageBox.Show("F");
                    }
                    else if (double.IsInfinity(h.Rate))
                    {
                        System.Windows.Forms.MessageBox.Show("W");
                    }
                }
                throw;
            }
        }
        public void AddTuple(DataSetTuple dataSetTuple)
        {
            _lifeTime  = 0;
            _weight    = 0;
            _frequency = 0;

            DataAggregatorTuple tuple = new DataAggregatorTuple();

            tuple.OldFeatures.Frequency = this.Frequency;
            tuple.OldFeatures.Weight    = this.Weight;
            tuple.OldFeatures.LifeTime  = this.LifeTime;

            this.DataSetTuples.Add(dataSetTuple);

            tuple.NewFeatures.Frequency = this.Frequency;
            tuple.NewFeatures.Weight    = this.Weight;
            tuple.NewFeatures.LifeTime  = this.LifeTime;

            tuple.SourceCluster = this;
            tuple.StartTime     = this.StartTime;
            DCC.Receive(tuple);
        }
        public void Purge(double newT0)
        {
            _lifeTime  = 0;
            _weight    = 0;
            _frequency = 0;

            DataAggregatorTuple tuple = new DataAggregatorTuple();

            tuple.OldFeatures.Frequency = this.Frequency;
            tuple.OldFeatures.Weight    = this.Weight;
            tuple.OldFeatures.LifeTime  = this.LifeTime;

            this.DataSetTuples.RemoveAll(x => x.StartTime < newT0);

            tuple.NewFeatures.Frequency = this.Frequency;
            tuple.NewFeatures.Weight    = this.Weight;
            tuple.NewFeatures.LifeTime  = this.LifeTime;

            tuple.SourceCluster = this;
            tuple.StartTime     = this.StartTime;

            DCC.Receive(tuple);
        }