From: Alexandre Terrasa Date: Thu, 23 Apr 2015 18:57:23 +0000 (-0400) Subject: metrics: fixe missing documentation warnings X-Git-Tag: v0.7.4~8^2~3 X-Git-Url: http://nitlanguage.org metrics: fixe missing documentation warnings Signed-off-by: Alexandre Terrasa --- diff --git a/src/metrics/metrics_base.nit b/src/metrics/metrics_base.nit index ba4856e..a7ded94 100644 --- a/src/metrics/metrics_base.nit +++ b/src/metrics/metrics_base.nit @@ -57,12 +57,12 @@ redef class ToolContext var opt_generate_hyperdoc = new OptionBool("Generate Hyperdoc", "--generate_hyperdoc") # --poset var opt_poset = new OptionBool("Complete metrics on posets", "--poset") - # --no-colors var opt_nocolors = new OptionBool("Disable colors in console outputs", "--no-colors") - - + # --dir var opt_dir = new OptionString("Directory where some statistics files are generated", "-d", "--dir") + + # Output directory for metrics files. var output_dir: String = "." redef init @@ -98,27 +98,41 @@ redef class ToolContext end end - # colorize heading 1 for console output + # Format and colorize a string heading of level 1 for console output. + # + # Default style is yellow and bold. fun format_h1(str: String): String do if opt_nocolors.value then return str return str.yellow.bold end + # Format and colorize a string heading of level 2 for console output. + # + # Default style is white and bold. fun format_h2(str: String): String do if opt_nocolors.value then return str return str.bold end + # Format and colorize a string heading of level 3 for console output. + # + # Default style is white and nobold. fun format_h3(str: String): String do if opt_nocolors.value then return str return str end + # Format and colorize a string heading of level 4 for console output. + # + # Default style is green. fun format_h4(str: String): String do if opt_nocolors.value then return str return str.green end + # Format and colorize a string heading of level 5 for console output. + # + # Default style is light gray. fun format_p(str: String): String do if opt_nocolors.value then return str return str.light_gray @@ -144,11 +158,20 @@ end # # The concept is reified here for a better organization and documentation interface Metric + + # Type of elements measured by this metric. type ELM: Object + + # Type of values used to measure elements. type VAL: Object + + # Type of data representation used to associate elements and values. type RES: Map[ELM, VAL] + # The name of this metric (generally an acronym about the metric). fun name: String is abstract + + # A long and understandable description about what is measured by this metric. fun desc: String is abstract # Clear all results for this metric @@ -230,7 +253,9 @@ class IntMetric redef type VAL: Int redef type RES: Counter[ELM] + # `IntMetric` uses a Counter to store values in intern. protected var values_cache = new Counter[ELM] + redef fun values do return values_cache redef fun clear do values_cache.clear @@ -279,7 +304,9 @@ class FloatMetric redef type VAL: Float + # `FloatMetric` uses a Map to store values in intern. protected var values_cache = new HashMap[ELM, VAL] + redef fun values do return values_cache redef fun clear do values_cache.clear @@ -353,6 +380,8 @@ end # # It purpose is to be extended with a metric collect service class MetricSet + + # Type of element measured by this `MetricSet`. type ELM: Object # Metrics to compute