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);
        }
Esempio n. 2
0
 private void buttonLoad_Click(object sender, EventArgs e)
 {
     try
     {
         ApplicationSettings.Instance.LoadFilePath = textBoxLoadPath.Text;
         int tuplesCount = StoneHandler.LoadDataSet(textBoxLoadPath.Text);
         WindowsHelperMethods.ShowInformationMessage("فایل DataSet با {0} Tuple موفقیت آمیز خوانده شد.", tuplesCount);
     }
     catch (Exception exception)
     {
         HandleUIException(exception, "Error when loading dataset file.");
     }
 }
Esempio n. 3
0
 private void buttonGenerate_Click(object sender, EventArgs e)
 {
     try
     {
         ApplicationSettings.Instance.GenerateFilePath = textBoxGeneratePath.Text;
         int tuplesCount = StoneHandler.GenerateDataSet(textBoxGeneratePath.Text);
         WindowsHelperMethods.ShowInformationMessage("فایل DataSet با {0} Tuple موفقیت آمیز ایجاد گردید.", tuplesCount);
     }
     catch (Exception exception)
     {
         HandleUIException(exception, "بروز خطا هنگام ایجاد فایل DataSet.");
     }
 }
Esempio n. 4
0
        private void buttonRun_Click(object sender, EventArgs e)
        {
            //BinaryMemory bm = new BinaryMemory();
            //var s = DateTime.Now;
            //bm.Add(1);
            //bm.Add(22);
            //bm.Add(333);
            //bm.Store(4444);
            //bm.Store(55555);
            //bm.Store(666666);
            //bm.Store(7777777);
            //bm.Store(88888888);
            //var st = (DateTime.Now - s).TotalMilliseconds;
            //MessageBox.Show("Stored in " + st);

            //s = DateTime.Now;
            //var r = bm.RetrieveItems();
            //st = (DateTime.Now - s).TotalMilliseconds;
            //MessageBox.Show("Retrieved in " + st);

            //MessageBox.Show(bm.Contains(3333).ToString());

            //r.ForEach(x => MessageBox.Show(x.ToString()));
            //return;
            try
            {
                HelperClasses.TimeTools timer = new HelperClasses.TimeTools();
                timer.Start();
                StoneHandler.Run();
                timer.Stop();
                WindowsHelperMethods.ShowInformationMessage("عملیات با موفقیت خاتمه یافت. زمان اجرا : {0} ثانیه.", timer.StringEllapsedTime);
            }
            catch (Exception exception)
            {
                HandleUIException(exception, "بروز خطا هنگام اجرای Stone.");
            }
        }
 private static void Timer_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     StoneHandler.Persist();
 }