Ejemplo n.º 1
0
        public void CreateData()
        {
            StatisticData.Add(new Data("Aktywne zadania: ", repository.AmountOfActiveTasks()));
            StatisticData.Add(new Data("Skończone zadania: ", repository.AmountOfFinishedTasks()));
            StatisticData.Add(new Data("Ilość zadań znajdujących się w koszu: ", repository.AmountOfFDeletedTasks()));
            StatisticData.Add(new Data("Średnia ilość dni potrzebnych na wykonanie zadania: ", repository.AverageFinishTime()));
            StatisticData.Add(new Data("Ilość dni najdłuższej trwającego zakończonego zadania: ", repository.DaysOfLongestTask()));

            StatisticData.Add(new Data("Wykonanych zadań na poziomie trudne: ", repository.AmountOfFinishedHardTasks()));
            StatisticData.Add(new Data("Wykonanych zadań na poziomie średnie: ", repository.AmountOfFinishedMediumTasks()));
            StatisticData.Add(new Data("Wykonanych zadań na poziomie łatwe: ", repository.AmountOfFinishedEasyTasks()));
            StatisticData.Add(new Data("Wykonanych zadań bez określonego poziomu: ", repository.AmountOfFinishedUndefinedTasks()));

            StatisticData.Add(new Data("Wykonanych zadań o priorytecie normalnym: ", repository.AmountOfFinishedHardTasks()));
            StatisticData.Add(new Data("Wykonanych zadań o priorytecie ważnym: ", repository.AmountOfFinishedImportantTasks()));
            StatisticData.Add(new Data("Wykonanych zadań o priorytecie krytycznym: ", repository.AmountOfFinishedCriticalTasks()));
            StatisticData.Add(new Data("Wykonanych zadań bez określonego priorytetu: ", repository.AmountOfFinishedUndefinedPriorityTasks()));

            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie zadania o priorytecie normlanym: ", repository.AmountOfDaysNeededForFinishingNormalTasks()));
            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie zadania o priorytecie ważnym: ", repository.AmountOfDaysNeededForFinishingImportantTasks()));
            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie zadania o priorytecie krytycznym: ", repository.AmountOfDaysNeededForFinishingCriticalTasks()));
            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie zadania bez określonego priorytetu: ", repository.AmountOfDaysNeededForFinishingUndefinedTasks()));

            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie trudnych zadań: ", repository.AmountOfDaysNeededForFinishingHardTasks()));
            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie średnich zadań: ", repository.AmountOfDaysNeededForFinishingMediumTasks()));
            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie łatwych zadań: ", repository.AmountOfDaysNeededForFinishingCriticalTasks()));
            StatisticData.Add(new Data("Średnia ilość dni potrzebna na wykonanie zadań bez okreśłonego poziomu: ", repository.AmountOfDaysNeededForFinishingEasyTasks()));
        }
Ejemplo n.º 2
0
        public void Canceled()
        {
            statisticData.State   = StatisticStates.canceled;
            statisticData.EndTime = DateTime.Now;

            this.statisticData = this.AddStatisticData(this.dataType, this.affectedJoint);
        }
Ejemplo n.º 3
0
        public DataOfAll() : base()
        {
            statisticData = StatisticData.GetAll(GameManager.ActivePatient);
            var exercise = GetFavoriteExercise();

            this.commonCountText = exercise == null ? "-" : exercise.Name;
        }
Ejemplo n.º 4
0
 public DataOfExercise(Exercise exercise) : base()
 {
     statisticData        = StatisticData.GetByExercise(GameManager.ActivePatient, exercise);
     this.statisticTitle  = exercise.Name;
     this.doneCountText   = this.CountExercises().ToString();
     this.commonCountText = GetFavoriteExercise().Name;
 }
Ejemplo n.º 5
0
        private async Task DoRandRawr(string s, StatisticData data)
        {
            List <SocketGuildUser> users;

            users = new List <SocketGuildUser>();
            foreach (var user in await Context.Channel.GetUsersAsync().FirstAsync())
            {
                if (user.Status != UserStatus.Offline)
                {
                    users.Add(Context.Guild.GetUser(user.Id));
                }
                else if (user.Status == UserStatus.Offline && s.ToLower() == "offline")
                {
                    users.Add(Context.Guild.GetUser(user.Id));
                }
            }
            int rand       = random.Next(users.Count);
            var userToRawr = users[rand];

            data.rand     = rand;
            data.count    = users.Count;
            data.username = HelperFunctions.NicknameOrUsername(userToRawr);
            //if(data==null){
            //    await _logger.LogAsync($"Counted {users.Count} members in {Context.Channel.Name}","rndRawr",LogSeverity.Verbose);
            //}else{
            await _logger.LogAsync($"selected {data.rand} from {data.count} users ({data.username}) in {data.channel} on {data.server}, added {data.addedCooldown} of cooldown", "rndRawr", LogSeverity.Verbose);

            //}

            await Context.Channel.SendMessageAsync($"{userToRawr.Mention} rawr");
        }
Ejemplo n.º 6
0
        private void allToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LoadStockPoolFile(dataGridViewObserved, "ObservedPool.xml");
            LoadStockPoolFile(dataGridViewLongTerm, "LongTermPool.xml");
            LoadStockPoolFile(dataGridViewTactical, "TacticalPool.xml");
            LoadStockPoolFile(dataGridViewShortTerm, "ShortTermPool.xml");
            LoadDealRecordPool();

            //Deserialize StatisticData
            if (File.Exists("StatisticData.xml"))
            {
                XmlSerializer xs = new XmlSerializer(typeof(StatisticData));
                m_statData = (StatisticData)xs.Deserialize(new XmlTextReader("StatisticData.xml"));
            }
            else
            {
                m_statData = new StatisticData();
            }

            if (File.Exists("NetAsset.xml"))
            {
                NetAssetdataset.ReadXml("NetAsset.xml");
            }
            else
            {
                NetAssetdataset = new AssetDS();
            }

            this.tabControl1.SelectedIndex = 0;
        }
Ejemplo n.º 7
0
 public InitializeClass(ILogger logger)
 {
     _logger = logger;
     _logger.Log(LogLevel.Info, "Start init");
     _statistic = new StatisticData();
     _service   = new WikiSarvice(logger);
     _connector = new RabbitConnector(_logger).Connect("localhost");
 }
Ejemplo n.º 8
0
        public DataOfDate(long date) : base()
        {
            statisticData = StatisticData.GetByDate(GameManager.ActivePatient, date);

            this.statisticTitle  = new DateTime(date).ToString("dd.MM.yyyy");
            this.commonCountText = GetFavoriteExercise().Name;
            this.doneCountText   = StatisticData.ExercisesByDate(GameManager.ActivePatient, date, false).Count.ToString();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Prevents a default instance of the ParallelServer class from being created
 /// </summary>
 private ParallelServer()
 {
     workingPackages  = new List <TPackage>();
     triggeredEvents  = new List <PackageFinishedEventArgsReTriggerContainer>();
     eventReTriggerer = new Timer(RetriggerEvents, string.Format("::{0}::", GetHashCode()), Timeout.Infinite,
                                  Timeout.Infinite);
     statData = new StatisticData();
 }
Ejemplo n.º 10
0
        public StatisticData AddStatistic(string name, StatisticType dataType, StatisticStates state, string message, PatientJoint affectedJoint)
        {
            var statistic = new StatisticData(date, name, dataType, state, message, affectedJoint, GameManager.ActiveExercise, GameManager.ActivePatient);

            GameManager.ActivePatient.CurrentStatistic.Add(statistic);

            return(statistic);
        }
Ejemplo n.º 11
0
 public new void Deserialize(IDataReader reader)
 {
     base.Deserialize(reader);
     Datas = new StatisticData[reader.ReadShort()];
     for (var i = 0; i < Datas.Length; i++)
     {
         (Datas[i] = new StatisticData()).Deserialize(reader);
     }
 }
 internal static void UpdateStatisticSchemaData(Did DatabaseId, StatisticData statisticData)
 {
     using (Stream stream = File.Open(String.Format("{0}{1}.dat", _storageDirectory, DatabaseId.Duid), FileMode.Create))
     {
         BinaryFormatter bFormatter = new BinaryFormatter();
         bFormatter.Serialize(stream, statisticData);
         stream.Close();
     }
 }
Ejemplo n.º 13
0
        public ExerciseByDateOrder(PatientManager patientManager, long date, GameObject buttonPrefab, GameObject buttonStorage) : base(patientManager, buttonPrefab, buttonStorage)
        {
            var exercises = StatisticData.ExercisesByDate(GameManager.ActivePatient, date);

            foreach (var exerciseId in exercises)
            {
                var exercise = Model.GetModel <Exercise>(exerciseId);
                base.CreateButton(exercise.UnityObjectName, exercise.Name);
            }
        }
Ejemplo n.º 14
0
        public DateOrder(PatientManager patientManager, GameObject buttonPrefab, GameObject buttonStorage) : base(patientManager, buttonPrefab, buttonStorage)
        {
            var ticks = StatisticData.Dates(GameManager.ActivePatient);

            foreach (var tick in ticks)
            {
                var date = new DateTime(tick);

                base.CreateButton(tick.ToString(), date.ToString("dd.MM.yyyy"));
            }
        }
Ejemplo n.º 15
0
        public override void Deserialize(IDataReader reader)
        {
            base.Deserialize(reader);
            uint num = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num; ++index)
            {
                StatisticData instance = ProtocolTypeManager.GetInstance <StatisticData>((uint)reader.ReadUShort());
                instance.Deserialize(reader);
                this.datas.Add(instance);
            }
        }
Ejemplo n.º 16
0
 public override void Serialize(IDataWriter writer)
 {
     base.Serialize(writer);
     writer.WriteShort((short)((int)this.datas.Length));
     StatisticData[] statisticDataArray = this.datas;
     for (int i = 0; i < (int)statisticDataArray.Length; i++)
     {
         StatisticData statisticDatum = statisticDataArray[i];
         writer.WriteShort(statisticDatum.TypeId);
         statisticDatum.Serialize(writer);
     }
 }
Ejemplo n.º 17
0
        public FulFillable(string name, StatisticType dataType, PatientJoint affectedJoint, FulFillable previous, int repetitions, WriteStatisticManager statisticManager)
        {
            this.logger.AddLogAppender <ConsoleAppender>();

            this.name             = name;
            this.previous         = previous;
            this.repetitions      = this.initialRepetitions = repetitions;
            this.statisticManager = statisticManager;
            this.dataType         = dataType;
            this.affectedJoint    = affectedJoint;

            this.statisticData = AddStatisticData(dataType, affectedJoint);
        }
Ejemplo n.º 18
0
        public override void Deserialize(IDataReader reader)
        {
            base.Deserialize(reader);
            var DatasCount = reader.ReadShort();

            Datas = new List <StatisticData>();
            for (var i = 0; i < DatasCount; i++)
            {
                StatisticData objectToAdd = ProtocolTypeManager.GetInstance(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                Datas.Add(objectToAdd);
            }
        }
Ejemplo n.º 19
0
        public override void Deserialize(IDataReader reader)
        {
            base.Deserialize(reader);
            var limit  = reader.ReadShort();
            var datas_ = new StatisticData[limit];

            for (int i = 0; i < limit; i++)
            {
                datas_[i] = Types.ProtocolTypeManager.GetInstance <StatisticData>(reader.ReadShort());
                datas_[i].Deserialize(reader);
            }
            datas = datas_;
        }
Ejemplo n.º 20
0
        public List <Int32> GetStatInfo(String DeckFile)
        {
            StatisticInfo o;

            if (StatisticData.TryGetValue(DeckFile, out o))
            {
                if (o.CardPackName == CardPack.LoadCardPackFromFile(DeckFile).PackName)
                {
                    return(o.StatInfo);
                }
            }
            return(null);
        }
Ejemplo n.º 21
0
        public async Task Load_Targets_Test()
        {
            StatisticData data = new StatisticData()
            {
                DateStart = "01.01.2021", DateEnd = "05.01.2021"
            };

            string login = "******";

            StatisticData result = await statisticService.LoadInfo(data, login);

            Assert.NotNull(result);
        }
Ejemplo n.º 22
0
        public override void Serialize(ICustomDataOutput writer)
        {
            base.Serialize(writer);
            writer.WriteShort(((short)(m_datas.Count)));
            int datasIndex;

            for (datasIndex = 0; (datasIndex < m_datas.Count); datasIndex = (datasIndex + 1))
            {
                StatisticData objectToSend = m_datas[datasIndex];
                writer.WriteUShort(((ushort)(objectToSend.TypeID)));
                objectToSend.Serialize(writer);
            }
        }
Ejemplo n.º 23
0
        public override void Deserialize(ICustomDataInput reader)
        {
            base.Deserialize(reader);
            var countDatas = reader.ReadShort();

            Datas = new List <StatisticData>();
            for (short i = 0; i < countDatas; i++)
            {
                var           datastypeId = reader.ReadShort();
                StatisticData type        = new StatisticData();
                type.Deserialize(reader);
                Datas.Add(type);
            }
        }
Ejemplo n.º 24
0
        public override void Deserialize(ICustomDataInput reader)
        {
            base.Deserialize(reader);
            int datasCount = reader.ReadUShort();
            int datasIndex;

            m_datas = new System.Collections.Generic.List <StatisticData>();
            for (datasIndex = 0; (datasIndex < datasCount); datasIndex = (datasIndex + 1))
            {
                StatisticData objectToAdd = ProtocolTypeManager.GetInstance <StatisticData>((short)reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                m_datas.Add(objectToAdd);
            }
        }
Ejemplo n.º 25
0
        public RabbitBuild(ILogger logger, IModel channel, string queue, object service, StatisticData statisticData)
        {
            _statisticData = statisticData;
            _service       = service;
            _logger        = logger;
            var queue1 = queue;

            _channel = channel;
            _channel.QueueDeclare(queue1, false, false, false, null);
            _channel.BasicQos(0, 100, false);
            _rabbitMqPublisher = new RabbitMqPublisher(_channel);
            EventingBasicConsumer eventingBasicConsumer = new EventingBasicConsumer(_channel);

            eventingBasicConsumer.Received += EventReceiver;
            channel.BasicConsume(queue1, true, eventingBasicConsumer);
            StartTimer();
            _rabbitMqPablishStatistic = new RabbitMqPablishStatistic();
        }
        internal static StatisticData GetStatisticSchemaData(Did DatabaseId)
        {
            if (!File.Exists(String.Format("{0}{1}.dat", _storageDirectory, DatabaseId.Duid)))
            {
                return(null);
            }

            StatisticData statisticData = null;

            using (
                Stream stream =
                    File.Open(
                        String.Format("{0}{1}.dat", Settings.GetInstance().ServerStatisticDataStorageDirectory, DatabaseId.Duid),
                        FileMode.Open))
            {
                BinaryFormatter bFormatter = new BinaryFormatter();
                statisticData = (StatisticData)bFormatter.Deserialize(stream);
                stream.Close();
            }
            return(statisticData);
        }
Ejemplo n.º 27
0
        private void CalculateBoxAndMahlerMethod()
        {
            BoxAndMahlerMethod rnd = new BoxAndMahlerMethod();

            double[] randomValues = rnd.Random(sampleSize, m, dpow2);

            double step = (double)rightXBorder / intervalsCount;

            ConstructBoxAndMahlerfrequencies(randomValues, step);
            ConstructBoxAndMahlerDistributionFunc(randomValues, step);

            double mx = StatisticData.CalculateMathExpectation(randomValues);
            double dx = StatisticData.CalculateDispersoin(randomValues, mx);

            label3.Text = "M(X) = " + mx + "   D(X) = " + dx;
            //вычисление критерия Колмагорова
            double kolmogorovCriterionLambdaValue = KolmogorovCriterion.GetLambda(randomValues, sampleSize);
            double kolmogorovCriterionValue       = KolmogorovCriterion.Calculate(randomValues, sampleSize);

            label4.Text = $"Лямбда по критерию Колмогорова равна {Math.Round(kolmogorovCriterionLambdaValue, 3)}; \nОценка генератора " +
                          $"случайных чисел равна {kolmogorovCriterionValue}";
        }
Ejemplo n.º 28
0
        private StatisticData ComputeStatisticData(PredictDataDetail currentPredictData, ICollection <PredictDataDetail> historyPredictDatas, NormConfigDto userNorm)
        {
            if (currentPredictData == null)
            {
                return(null);
            }
            var statisticData = new StatisticData()
            {
                CurrentScore = currentPredictData.CurrentScore,
            };

            statisticData.MaxSerieError =
                ComputeArrayMaxCount(historyPredictDatas.Select(p => p.PredictedResult).ToArray(), 1);
            statisticData.MaxSerieRight =
                ComputeArrayMaxCount(historyPredictDatas.Select(p => p.PredictedResult).ToArray(), 0);

            int currentSerie  = 0;
            var currentResult = historyPredictDatas.First().PredictedResult;

            foreach (var data in historyPredictDatas)
            {
                currentSerie++;
                if (currentResult != data.PredictedResult)
                {
                    break;
                }
            }
            statisticData.CurrentSerie = currentSerie;
            var minorCycleStatistic = new Dictionary <int, int>();

            for (int i = 1; i <= userNorm.PlanCycle; i++)
            {
                var thisCysleRightCount = historyPredictDatas.Count(p => p.PredictedResult == 0 && p.MinorCycle == i);
                minorCycleStatistic.Add(i, thisCysleRightCount);
            }
            statisticData.MinorCycleStatistic = minorCycleStatistic;
            return(statisticData);
        }
Ejemplo n.º 29
0
        private void CalculateCentralLimitTheorem()
        {
            CentralLimitTheorem rnd = new CentralLimitTheorem();

            double[] randomValues = rnd.Random(sampleSize, m, dpow2);

            double step = (double)rightXBorder / intervalsCount;

            ConstructFrequencyHistogram(randomValues, step);

            ConstructStatisticalDistributionFunction(randomValues, step);

            double mx = StatisticData.CalculateMathExpectation(randomValues);
            double dx = StatisticData.CalculateDispersoin(randomValues, mx);

            label1.Text = "M(X) = " + mx + "   D(X) = " + dx;
            //вычисление критерия Колмагорова
            double kolmogorovCriterionLambdaValue = KolmogorovCriterion.GetLambda(randomValues, sampleSize);
            double kolmogorovCriterionValue       = KolmogorovCriterion.Calculate(randomValues, sampleSize);

            label2.Text = $"Лямбда по критерию Колмогорова равна {Math.Round(kolmogorovCriterionLambdaValue, 3)}; \nОценка генератора " +
                          $"случайных чисел равна {kolmogorovCriterionValue}";
        }
Ejemplo n.º 30
0
        public GlobalStatisticsPerYear(int[] calculatedYears, IEnumerable <StatisticsSubjectPerYear <T> > dataForAllIcos,
                                       Func <T, bool> allowedItems = null)
        {
            this.CalculatedYears = calculatedYears;
            allowedItems         = allowedItems ?? alwaysTrue;

            // kdyby nás někoho náhodou napadlo dát do statistik string, tak tohle by to mělo pohlídat
            var numericProperties = typeof(T).GetProperties().Where(p => IsNumericType(p.PropertyType));

            //todo: asi by se dalo zrychlit, kdyby se nejelo po jednotlivých property, ale všechny property najednou
            // dneska na to už ale mentálně nemam :)
            // případně by se dalo paralelizovat do threadů (udělat paralel foreach a jet každý rok v samostatném threadu)
            // musel by se jen zamykat zápis do statistic data (třeba v setteru)
            Util.Consts.Logger.Debug($"Starting calculation of all properties for {string.Join(",", this.CalculatedYears)}");

            foreach (var year in CalculatedYears)
            {
                Devmasters.Batch.Manager.DoActionForAll <PropertyInfo>(numericProperties,
                                                                       property => {
                    Util.Consts.Logger.Debug($"Starting property {property} for {year}");
                    IEnumerable <decimal> globalData = dataForAllIcos
                                                       .Select(d => d[year])
                                                       .Where(allowedItems)
                                                       .Select(d =>
                                                               GetDecimalValueOfNumericProperty(property, d))
                                                       .Where(d => d.HasValue)
                                                       .Select(d => d.Value);
                    Util.Consts.Logger.Debug($"calc percentiles for property {property} for {year}");
                    var val = new PropertyYearPercentiles(property.Name, year, globalData);
                    StatisticData.Add(val);
                    Util.Consts.Logger.Debug($"Done property {property} for {year}");

                    return(new Devmasters.Batch.ActionOutputData());
                }, true);
            }
            Util.Consts.Logger.Debug($"Done calculation of all properties for {string.Join(",", this.CalculatedYears)}");
        }
Ejemplo n.º 31
0
        private void allToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LoadStockPoolFile(dataGridViewObserved, "ObservedPool.xml");
            LoadStockPoolFile(dataGridViewLongTerm, "LongTermPool.xml");
            LoadStockPoolFile(dataGridViewTactical, "TacticalPool.xml");
            LoadStockPoolFile(dataGridViewShortTerm, "ShortTermPool.xml");
            LoadDealRecordPool();

            //Deserialize StatisticData
            if (File.Exists("StatisticData.xml"))
            {
                XmlSerializer xs = new XmlSerializer(typeof(StatisticData));
                m_statData = (StatisticData)xs.Deserialize(new XmlTextReader("StatisticData.xml"));
            }
            else
                m_statData = new StatisticData();

            if (File.Exists("NetAsset.xml"))
                NetAssetdataset.ReadXml("NetAsset.xml");
            else
                NetAssetdataset = new AssetDS();

            this.tabControl1.SelectedIndex = 0;
        }