コード例 #1
0
 public static void Add(StoneCluster stoneCluster)
 {
     if (!Clustres.Contains(stoneCluster))
     {
         Clustres.Add(stoneCluster);
     }
 }
コード例 #2
0
        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);
     }
 }