No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Stat.cs

Description du code

Stat.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace be.gaudry.model
  5. {
  6. public class Stat
  7. {
  8. #region declarations and constructors
  9. private string labelFormat;
  10. private double total;
  11. private Dictionary<string, double> values;
  12.  
  13. public Stat()
  14. {
  15. values = new Dictionary<string, double>();
  16. labelFormat = "{0:0.0%} pour un total de {1}";
  17. }
  18. public Stat(Dictionary<string, double> values, string labelFormat)
  19. {
  20. this.values = values;
  21. foreach (double i in values.Values)
  22. {
  23. this.total += i;
  24. }
  25. this.labelFormat = labelFormat;
  26. }
  27. public Stat(string labelFormat)
  28. : this()
  29. {
  30. this.labelFormat = labelFormat;
  31. }
  32. #endregion
  33.  
  34. #region properties
  35.  
  36. public Dictionary<string, double> Dictionary
  37. {
  38. get { return values; }
  39. set { this.values = value; }
  40. }
  41. public double Total
  42. {
  43. get { return total; }
  44. }
  45.  
  46. public double[] Values
  47. {
  48. get
  49. {
  50. double[] tValues = new double[values.Count];
  51. int i = 0;
  52. foreach (KeyValuePair<string, double> kvp in values)
  53. {
  54. tValues[i++] = kvp.Value;
  55. }
  56. return tValues;
  57. }
  58. }
  59. public String[] Texts
  60. {
  61. get
  62. {
  63.  
  64. string[] texts = new string[values.Count];
  65. int i = 0;
  66. foreach (KeyValuePair<string, double> kvp in values)
  67. {
  68. texts[i++] = kvp.Key;
  69. }
  70. return texts;
  71. }
  72. }
  73.  
  74. public String[] Labels
  75. {
  76. get
  77. {
  78. string[] labels;
  79. labels = new String[values.Count];
  80. int i = 0;
  81. foreach (KeyValuePair<string, double> kvp in values)
  82. {
  83. labels[i++] = String.Format(labelFormat, ((double)kvp.Value / total), kvp.Value, kvp.Key);
  84. }
  85. return labels;
  86. }
  87. }
  88.  
  89. public String LabelFormat
  90. {
  91. get { return labelFormat; }
  92. set { labelFormat = value; }
  93. }
  94. #endregion
  95.  
  96. #region public methods
  97. /// <summary>
  98. /// Increase value according to the key. Increase step is 1.
  99. /// </summary>
  100. /// <param name="key">string used as key to retreive the value to increase.</param>
  101. public void increase(string key)
  102. {
  103. increase(key, 1);
  104. }
  105. /// <summary>
  106. /// Increase value according to the key, with given step.
  107. /// </summary>
  108. /// <param name="key">string used as key to retreive the value to increase.</param>
  109. /// <param name="step">double used to increase the value according to the key.</param>
  110. public void increase(string key, double step)
  111. {
  112. if (!values.ContainsKey(key))
  113. {
  114. values.Add(key, 0);
  115. }
  116. total += step;
  117. values[key] += step;
  118. }
  119. /// <summary>
  120. /// Delete all key/value pairs and reset total.
  121. /// Don't reset labelFormat.
  122. /// </summary>
  123. public void clear()
  124. {
  125. total = 0;
  126. values.Clear();
  127. }
  128. #endregion
  129. }
  130. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/model/ 
IcôneNomTailleModification
IcôneNomTailleModification
| _ Répertoire parent0 octets1711720255 29/03/2024 14:50:55
| _config0 octets1541007188 31/10/2018 18:33:08
| _enums0 octets1541007189 31/10/2018 18:33:09
| _exceptions0 octets1541007189 31/10/2018 18:33:09
| _drawing0 octets1541007188 31/10/2018 18:33:08
| _win320 octets1541007190 31/10/2018 18:33:10
| _file0 octets1541007190 31/10/2018 18:33:10
| _comparators0 octets1541007188 31/10/2018 18:33:08
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/model/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csWebHelper.cs841 octets31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csHistory.cs6.96 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csValueObject.cs664 octets31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csExport.cs13.3 Ko31/10/2018 18:32:47-refusé-
Afficher le fichier .cs|.csDisposableObject.cs883 octets31/10/2018 18:32:47-refusé-
Afficher le fichier .cs|.csStat.cs3.63 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csTextHelper.cs8.11 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csUnits.cs2.07 Ko31/10/2018 18:32:48-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-broldev-source-rf-model/Stat.cs.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.