Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

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 octets1713979418 24/04/2024 19:23:38
| _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.

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 16/10/2009 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/cs-broldev-source-rf-model/Stat.cs.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.