public static string GetPerformanceCounterName(StatisticType statType, int hospitalId) { string name; switch (statType) { case StatisticType.AvgTimeToSeeADoctor: name = $"(H{hospitalId}) {CounterAvgTimeToSeeADoctor}"; break; case StatisticType.AvgAppointmentDuration: name = $"(H{hospitalId}) {CounterAvgAppointmentDuration}"; break; case StatisticType.Illness: name = $"(H{hospitalId}) {CounterPerDisease}"; break; case StatisticType.EstimatedTimeToSeeADoctor: name = $"(H{hospitalId}) {CounterEstimatedTimeToSeeADoctor}"; break; default: throw new ArgumentOutOfRangeException("statType"); } return(name); }
public StatisticEvent(T value, StatisticType metric) { Timestamp = DateTime.Now; Message = value.ToString(); Value = value; Metric = metric; }
public void AddDefinition(int statName, string description, StatisticType type) { if (m_StatisticsDefinitions.Find(s => s.Name == statName) == null) { m_StatisticsDefinitions.Add(new StatisticDefinition(statName, description, type)); } }
private void LoadDefinitions(string definitionJSON) { Hashtable jsonTable = MiniJSON.jsonDecode(definitionJSON) as Hashtable; if (jsonTable != null) { ArrayList statDefinitions = jsonTable["statDefinitions"] as ArrayList; if (statDefinitions != null) { foreach (Hashtable statDefinition in statDefinitions) { string id = statDefinition["id"] as string; string desc = statDefinition["description"] as string; string typeString = statDefinition["type"] as string; if (typeString != null) { try { StatisticType statisticType = (StatisticType)Enum.Parse(typeof(StatisticType), typeString, true); if (Enum.IsDefined(typeof(StatisticType), statisticType)) { if (id == null) { Debug.LogWarning("[Stats] Missing id"); continue; } if (desc == null) { Debug.LogWarning("[Stats] Missing description"); continue; } AddDefinition(id, desc, statisticType); } else { Debug.LogWarning(string.Format("[Stats] {0} is not an underlying value of the StatisticType enumeration.", typeString)); } } catch (ArgumentException) { Debug.LogWarning(string.Format("[Stats] {0} is not a member of the StatisticType enumeration.", typeString)); } } } } } else { if (!MiniJSON.lastDecodeSuccessful()) { Debug.LogWarning(string.Format("[Stats] Unable to decode JSON definition file. Error: {0}", MiniJSON.getLastErrorSnippet())); } else { Debug.LogWarning("[Stats] Unable to decode JSON definition file."); } } }
public static void DistributeAP(Character character, StatisticType type, short amount = 1) { switch (type) { case StatisticType.Strength: character.Strength += amount; break; case StatisticType.Dexterity: character.Dexterity += amount; break; case StatisticType.Intelligence: character.Intelligence += amount; break; case StatisticType.Luck: character.Luck += amount; break; case StatisticType.MaxHealth: // TODO: Get addition based on other factors. break; case StatisticType.MaxMana: // TODO: Get addition based on other factors. break; } }
private void HandleStatisticChange(StatisticType statistic, float previousValue, float currentValue) { switch (statistic) { case StatisticType.Hp: UpdateHp(Mathf.RoundToInt(currentValue)); break; case StatisticType.Sp: UpdateSp(Mathf.RoundToInt(currentValue), Mathf.RoundToInt(playerCharacter[StatisticType.Osp])); break; case StatisticType.Osp: UpdateSp(Mathf.RoundToInt(playerCharacter[StatisticType.Sp]), Mathf.RoundToInt(currentValue)); break; case StatisticType.MaxSp: UpdateMaxSp(Mathf.FloorToInt(currentValue + playerCharacter[StatisticType.MaxOsp])); break; case StatisticType.MaxOsp: UpdateMaxSp(Mathf.FloorToInt(currentValue + playerCharacter[StatisticType.MaxSp])); break; case StatisticType.UltimateEnergy: UpdateFever(Mathf.RoundToInt(currentValue)); break; } }
public RawStatistic( string seed) { var _match = RawStatistic.c_parsingRegex.Match(seed); if (!_match.Success) { throw new ApplicationException("Parse failure"); } var _typeIdentifier = _match.Groups["typeIdentifier"].Value; if (_typeIdentifier == "c") { this.Type = StatisticType.Counter; } else if (_typeIdentifier == "g") { this.Type = StatisticType.Gauge; } else if (_typeIdentifier == "ms") { this.Type = StatisticType.Timer; } else { throw new ApplicationException("Unknown statistic type"); } this.Key = _match.Groups["key"].Value; this.Value = double.Parse(_match.Groups["value"].Value); this.SampleRate = double.Parse("0" + _match.Groups["sampleRate"].Value); }
/// <summary> /// 开始计时 /// </summary> /// <param name="type"></param> public void StartTiming(StatisticType type, string msg, bool ime = false) { if (CurType != type || ime) { var now = DateTime.Now; var span = now - StartTime; if (CurType == StatisticType.Producte) { this.ProductTime += span; // csv [line-2] [开始时间] - [结束时间] -- [msg] } else if (CurType == StatisticType.DT) { this.DTTime += span; } else if (CurType == StatisticType.WaitProducte) { this.WaitProductTime += span; } CurType = type; StartTime = now; if (type == StatisticType.Producte) { // csv [line-1] [开始时间] - [] -- [msg] } else if (type == StatisticType.DT) { } else if (type == StatisticType.WaitProducte) { } } }
public bool PushReport(string[] serverNames, DateTime dateTime, StatisticType statisticType) { switch (statisticType) { case StatisticType.Day: PushDailyReport(serverNames, dateTime); break; case StatisticType.Week: PushWeeklyReport(serverNames, dateTime); break; case StatisticType.Month: PushMonthlyReport(serverNames, dateTime); break; case StatisticType.Quarter: break; case StatisticType.Year: break; default: break; } return(true); }
public static double StatisticTypeValue(this Datapoint dataPoint, StatisticType statisticType) { switch (statisticType) { case StatisticType.Average: return(dataPoint.Average); case StatisticType.Sum: return(dataPoint.Sum); case StatisticType.SampleCount: return(dataPoint.SampleCount); case StatisticType.Maximum: return(dataPoint.Maximum); case StatisticType.Minimum: return(dataPoint.Minimum); case StatisticType.p10: case StatisticType.p50: case StatisticType.p90: case StatisticType.p95: case StatisticType.p99: return(dataPoint.ExtendedStatistics.Single().Value); default: throw new InvalidOperationException($"Statistic type {statisticType} not supported"); } }
public async Task <Response> UpdatePostStatisticAsync(Guid postId, StatisticType statisticType) { try { var pp = _postExtensionRepository.Get(postId); if (pp == null) { return(new FailedResponse((int)ResponseFailureCode.PostNotFound)); } if (statisticType == StatisticType.Hits) { pp.Hits += 1; } if (statisticType == StatisticType.Likes) { pp.Likes += 1; } await _postExtensionRepository.UpdateAsync(pp); return(new SuccessResponse()); } catch (Exception e) { Logger.LogError(e, $"Error {nameof(UpdatePostStatisticAsync)}(postId: {postId}, statisticType: {statisticType})"); return(new FailedResponse((int)ResponseFailureCode.GeneralException)); } }
public float this[StatisticType type] { get { return(statistics[type]); } }
///// <summary> ///// All status effects applied to this system in time order ///// </summary> //private StatusEffectQueue statusEffects = new StatusEffectQueue(); public float this[StatisticType type] { get { return(statistics.ContainsKey(type) ? statistics[type] : 0); } set { if (!statistics.ContainsKey(type)) { if (value != 0) { statistics.Add(type, value); onStatisticChange.Invoke(type, 0, value); } } else { float previousValue = statistics[type]; if (value != previousValue) { statistics[type] = value; onStatisticChange.Invoke(type, previousValue, value); } } } }
/// <summary> /// Simple 1-value score /// </summary> /// <param name="caption"></param> /// <param name="type"></param> private void DisplayScore(string caption, StatisticType type) { var score = Instantiate(scoreViewPrefab, Vector3.zero, Quaternion.identity, scoreRoot); score.Caption = caption; score.Value = Statistics.Stats[type].Value.ToString(); }
public Task Execute(IJobExecutionContext context) { Console.WriteLine("Starting statistics persistence in database"); var calculation = (INewCalculationTask)context.MergedJobDataMap.Get("calculation"); try { using (StatisticContext dbContext = new StatisticContext()) { dbContext.Database.EnsureCreated(); foreach (var operation in calculation.GetOperations()) { foreach (KeyValuePair <String, Statistic> kvp in operation.GetComputeDictionary()) { StatisticType statisticType = dbContext.StatisticTypes.Single(st => st.Name == operation.GetName()); kvp.Value.StatisticType = statisticType; dbContext.Statistics.Add(kvp.Value); } operation.GetComputeDictionary().Clear(); } dbContext.SaveChanges(); } } catch (Exception ex) { Console.WriteLine(ex); } Console.WriteLine("Persistence finished"); return(Task.FromResult(0)); }
public StatisticsUserControl(DataBase db, StatisticType statisticType) { _dataBase = db; _bigChartActive = false; DataContext = this; InitializeComponent(); StatisticColumns = 2; if (statisticType == StatisticType.Overview) { // Spezial Fall -> zeige eine Übersicht ausgewählter Statistiken OverviewVisible = true; StaticticsShowOverView(); } else { // Zeige ausgewählte Einzelstatistik OverviewVisible = false; } return; }
public void AddStatistic(string json, DateTime calculationDateTime, StatisticType type, IReadOnlyList <string> collectionIds) { ExecuteQuery(() => { using (var database = Context.CreateDatabaseContext()) { var collection = database.GetCollection <Statistic>(); var statistics = collection .Find(x => x.Type == type) .GetStatisticsWithCollectionIds(collectionIds) .ToList(); statistics.ForEach(x => x.IsValid = false); collection.Update(statistics); var statistic = new Statistic { CalculationDateTime = calculationDateTime, CollectionIds = collectionIds, Type = type, JsonResult = json, IsValid = true }; collection.Insert(statistic); } }); }
public static string GetPerformanceCounterName( StatisticType statType, int hospitalId ) { string name; switch ( statType ) { case StatisticType.AvgTimeToSeeADoctor: name = $"(H{hospitalId}) {CounterAvgTimeToSeeADoctor}"; break; case StatisticType.AvgAppointmentDuration: name = $"(H{hospitalId}) {CounterAvgAppointmentDuration}"; break; case StatisticType.Illness: name = $"(H{hospitalId}) {CounterPerDisease}"; break; case StatisticType.EstimatedTimeToSeeADoctor: name = $"(H{hospitalId}) {CounterEstimatedTimeToSeeADoctor}"; break; default: throw new ArgumentOutOfRangeException( "statType" ); } return name; }
public IPlotTimeBuilder PlotGraph(GraphType graphType, StatisticType statisticType, TimeSpan period) { StatisticType = statisticType; GraphType = graphType; Period = period; return(plotTimeBuilder); }
public AngleValueBehaviour(double value, string unityObjectName, StatisticType statisticType, PatientJoint affectedJoint, PatientJoint activeJoint, PatientJoint childJoint, SettingsManager settingsManager, Feedback feedback, PitchType pitchType, FulFillable previous, int repetitions, WriteStatisticManager statisticManager) : base(value, unityObjectName, statisticType, affectedJoint, activeJoint, childJoint, settingsManager, feedback, pitchType, previous, repetitions, statisticManager) { this.tolerance = settingsManager.GetValue <int>("ingame", "angleTolerance"); this.angle = 0; this.minAngle = initialValue - tolerance; this.maxAngle = initialValue + tolerance; }
public static ChangeRule Create(string[] subs) { Client c = new Client(subs[1]); StatisticType type = StatisticType.Max; if (subs[3].Equals("max", StringComparison.InvariantCultureIgnoreCase)) { type = StatisticType.Max; } else if (subs[3].Equals("min", StringComparison.InvariantCultureIgnoreCase)) { type = StatisticType.Min; } else if (subs[3].Equals("std", StringComparison.InvariantCultureIgnoreCase)) { type = StatisticType.Std; } else if (subs[3].Equals("median", StringComparison.InvariantCultureIgnoreCase)) { type = StatisticType.Median; } else if (subs[3].Equals("mean", StringComparison.InvariantCultureIgnoreCase)) { type = StatisticType.Mean; } else { throw new InvalidOperationException("dont know the type"); } ChangeRule r = new ChangeRule(c, type, Convert.ToDouble(subs[4])); return(r); }
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); }
public ChartLine(StatisticType statisticType, StatisticValue valueType) { MinHeight = 0; Title = $"{valueType.ToString()} {statisticType.ToString().ToLower()}"; Values = new ChartValues <double>(); Statistic = statisticType; Value = valueType; }
public Statistic(int name, StatisticType type) { m_Name = name; if (type == StatisticType.Min) { m_CurrentValue = int.MaxValue; } }
public async Task <IActionResult> Index(StatisticType statisticType) { var userDetails = await userManager.GetUserAsync(User); var model = await viewModelBuilder.WithStatisticType(statisticType).WithUser(userDetails).Build(); return(View(model)); }
// public bool AddStatusEffect(StatusEffect statusEffect) // { // bool isExisted = statusEffects.Contains(statusEffect); // if (statusEffects.Push(statusEffect)) // { //#if UNITY_EDITOR // Debug.Log(LogUtility.MakeLogString("StatisticSystem", "Add " + statusEffect + "\n" + ToString())); //#endif // UpdateChangedStatistics(statusEffect); // onStatusEffectChange.Invoke(isExisted ? 0 : 1, statusEffect); // return true; // } // return false; // } // public StatusEffect RemoveStatusEffect(int id) // { // StatusEffect statusEffect = statusEffects.Remove(id); // if (statusEffect != null) // { //#if UNITY_EDITOR // Debug.Log(LogUtility.MakeLogString("StatisticSystem", "Remove " + statusEffect + "\n" + ToString())); //#endif // UpdateChangedStatistics(statusEffect); // onStatusEffectChange.Invoke(-1, statusEffect); // } // return statusEffect; // } public float CalculateModified(StatisticType type, params IAttributeCollection[] modifiers) { IAttributeCollection[] args = new IAttributeCollection[attributeSets.Length + modifiers.Length]; Array.Copy(attributeSets, args, attributeSets.Length); Array.Copy(modifiers, 0, args, attributeSets.Length, modifiers.Length); return(Calculate(type, args)); }
private VariousDetailsStatisticItem(StatisticType type, string username, Uri link) : base(type, username) { Details = new Dictionary <string, string>() { { DetailKeys.Link, link.ToString() }, }; }
protected StatisticItem(StatisticType type, string username) { Type = type; Username = username; Timestamp = DateTime.UtcNow; Details = null; UpdateId = Guid.Empty; }
private VariousDetailsStatisticItem(StatisticType type, string username, string searchFor) : base(type, username) { Details = new Dictionary <string, string>() { { DetailKeys.SearchFor, searchFor }, }; }
private AuthenticationStatisticItem(StatisticType type, string username, string username2) : base(type, username) { Details = new Dictionary <string, string>() { { DetailKeys.Username, username2 }, }; }
private NavigationStatisticItem(StatisticType type, string username, string itemId) : base(type, username) { Details = new Dictionary <string, string>() { { DetailKeys.ItemId, itemId }, }; }
public Statistic(int name, StatisticType type) { m_Name = name; if (type == StatisticType.Min) m_CurrentValue = int.MaxValue; }
public Task(int name, StatisticType type, int goal) : base(name, type) { m_Goal = goal; }
public Dictionary<MaxMinValue, int> CalculateIntValue(List<MaxMinValue> MaxMinList, StatisticType statType, GeoPolygonRegion polygonRegion) { Dictionary<MaxMinValue, int> intCountDic = new Dictionary<MaxMinValue, int>(); ValueMatrixIntCollection studyValueMatrix = (ValueMatrixIntCollection) this.m_Study.StudyValueMatrix; if (studyValueMatrix == null) { return null; } this.m_NeedSolveFloatMaxShortMin = this.NeedSolveFloatMaxShortMinValue(MaxMinList); studyValueMatrix.Open(this.m_SubSysInterface.ProjectManager); foreach (MaxMinValue value2 in MaxMinList) { intCountDic[value2] = 0; } this.GetIntCountDic(studyValueMatrix, ref intCountDic, MaxMinList, statType, polygonRegion); studyValueMatrix.Close(false); return intCountDic; }
public Dictionary<MaxMinValue, int> CalculateShortValue(List<MaxMinValue> MaxMinList, StatisticType statType, GeoPolygonRegion polygon) { ValueMatrixShortCollection studyValueMatrix = (ValueMatrixShortCollection) this.m_Study.StudyValueMatrix; if (studyValueMatrix == null) { return null; } return this.CalculateShortValue(MaxMinList, statType, studyValueMatrix, polygon); }
public Dictionary<MaxMinValue, int> CalculateShortValue(List<MaxMinValue> MaxMinList, StatisticType statType, ValueMatrixShortCollection valuematrix, GeoPolygonRegion polygon) { Dictionary<MaxMinValue, int> intCountDic = new Dictionary<MaxMinValue, int>(); this.m_NeedSolveFloatMaxShortMin = this.NeedSolveFloatMaxShortMinValue(MaxMinList); valuematrix.Open(this.m_SubSysInterface.ProjectManager); foreach (MaxMinValue value2 in MaxMinList) { intCountDic[value2] = 0; } this.GetShortCountDic(valuematrix, ref intCountDic, MaxMinList, statType, polygon); valuematrix.Close(false); return intCountDic; }
private void GetGeneralCountDic(double powervalue, ref Dictionary<MaxMinValue, int> intCountDic, List<MaxMinValue> MaxMinList, StatisticType statType) { foreach (MaxMinValue value2 in MaxMinList) { double max = value2.max; double min = value2.min; if (((powervalue > min) && (powervalue < max)) || (powervalue == max)) { intCountDic[value2] += 1; this.m_ValidPoint++; break; } } }
private void GetShortCountDic(ValueMatrixShortCollection valuematrix, ref Dictionary<MaxMinValue, int> intCountDic, List<MaxMinValue> MaxMinList, StatisticType statType, GeoPolygonRegion polygon) { if (this.m_NeedSolveFloatMaxShortMin[0]) { this.m_ActualMinValue = 0x7fffffff; } if (this.m_NeedSolveFloatMaxShortMin[1]) { this.m_ActualMaxValue = -32768f; } this.m_ValidPoint = 0.0; foreach (short num in valuematrix.GetValidPointsValue(polygon, this.m_PredictionGroup.Resolution)) { if (num != -32768) { if (num > this.m_ActualMaxValue) { this.m_ActualMaxValue = num; } if (num < this.m_ActualMinValue) { this.m_ActualMinValue = num; } double powervalue = num; this.GetGeneralCountDic(powervalue, ref intCountDic, MaxMinList, statType); } } }
public void Statistic(StatisticType type, int width, int height) { IntPtr exception = IntPtr.Zero; IntPtr result; #if ANYCPU if (NativeLibrary.Is64Bit) #endif #if WIN64 || ANYCPU result = NativeMethods.X64.MagickImage_Statistic(Instance, (UIntPtr)type, (UIntPtr)width, (UIntPtr)height, out exception); #endif #if ANYCPU else #endif #if !WIN64 || ANYCPU result = NativeMethods.X86.MagickImage_Statistic(Instance, (UIntPtr)type, (UIntPtr)width, (UIntPtr)height, out exception); #endif CheckException(exception, result); Instance = result; }
public StatisticDefinition(int name, string description, StatisticType type) { m_Name = name; m_Description = description; m_Type = type; }
public EncryptedPref this[StatisticType _type] { get { return m_Statistics[_type]; } }