public static void Add(StoneCluster stoneCluster)
 {
     if (!Clustres.Contains(stoneCluster))
     {
         Clustres.Add(stoneCluster);
     }
 }
        public void AddTuple(DataSetTuple dataSetTuple)
        {
            if (!this.Initialized)
            {
                StoneHandler.Refresh();
                this.T0          = dataSetTuple.StartTime;
                this.Initialized = true;
            }
            else if ((dataSetTuple.StartTime - this.T0) > this.Size)
            {
                this.Shift(dataSetTuple);
            }

            StoneCluster cluster;
            var          findedClusters = this.Clusters.Where(x => x.Prefix == dataSetTuple.ClusterPrefix);

            if (findedClusters.Count() == 0)
            {
                cluster = new StoneCluster(dataSetTuple.ClusterPrefix);
                this.Clusters.Add(cluster);
            }
            else if (findedClusters.Count() == 1)
            {
                cluster = findedClusters.First();
            }
            else
            {
                throw new HelperClasses.LibraryException("{0} کلاستر با پیشوند {1} وجود دارد.", findedClusters.Count(), dataSetTuple.ClusterPrefix);
            }

            cluster.AddTuple(dataSetTuple);
        }
예제 #3
0
 public void RemoveCluster(StoneCluster stoneCluster)
 {
     if (!this.Clusters.Contains(stoneCluster))
     {
         return;
     }
     this.Clusters.Remove(stoneCluster);
 }
예제 #4
0
 public void AddCluster(StoneCluster stoneCluster)
 {
     if (this.Clusters.Contains(stoneCluster))
     {
         return;
     }
     this.Clusters.Add(stoneCluster);
 }
예제 #5
0
 public static void Refresh()
 {
     AcquaintanceList = new List <StoneCluster>();
     foreach (var dbCluster in DB.NewContext.ClusterHistories.Where(x => x.Day < ApplicationSettings.Instance.HistoryDaysCount))
     {
         var cluster = new StoneCluster(dbCluster.ClusterPrefix, dbCluster.W, dbCluster.T, dbCluster.F);
         AcquaintanceList.Add(cluster);
     }
 }