Class XFrequency

java.lang.Object
org.opentrafficsim.water.statistics.XFrequency
All Implemented Interfaces:
java.io.Serializable

public class XFrequency
extends java.lang.Object
implements java.io.Serializable

Copyright (c) 2011-2013 TU Delft, Faculty of TBM, Systems and Simulation
This software is licensed without restrictions to Nederlandse Organisatie voor Toegepast Natuurwetenschappelijk Onderzoek TNO (TNO), Erasmus University Rotterdam, Delft University of Technology, Panteia B.V., Stichting Projecten Binnenvaart, Ab Ovo Nederland B.V., Modality Software Solutions B.V., and Rijkswaterstaat - Dienst Water, Verkeer en Leefomgeving, including the right to sub-license sources and derived products to third parties.
Version:
Mar 24, 2013
Author:
Alexander Verbraeck
See Also:
Serialized Form
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.lang.String description
    description refers to the title of this counter
    protected java.util.SortedMap<java.lang.String,​java.lang.Long> frequency
    count represents the values of the counters
    protected long n
    n represents the number of measurements
  • Constructor Summary

    Constructors 
    Constructor Description
    XFrequency​(java.lang.String description)  
  • Method Summary

    Modifier and Type Method Description
    void count​(java.lang.String key)
    count 1
    void count​(java.lang.String key, long value)
    count frequency
    java.lang.String getDescription()
    returns the description of the counter
    java.util.SortedMap<java.lang.String,​java.lang.Long> getFrequencies()
    Returns all counters
    long getFrequency​(java.lang.String key)
    Returns the current counter value for a key
    long getN()
    Returns the current number of observations
    void initialize()
    initializes the counter
    boolean isInitialized()
    is the counter initialized?
    java.lang.String toString()  
    int writeToExcel​(Sheet sheet, int startRow)
    Write statistics to an excel spreadsheet, starting on row "startRow"

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • frequency

      protected java.util.SortedMap<java.lang.String,​java.lang.Long> frequency
      count represents the values of the counters
    • n

      protected long n
      n represents the number of measurements
    • description

      protected java.lang.String description
      description refers to the title of this counter
  • Constructor Details

    • XFrequency

      public XFrequency​(java.lang.String description)
      Parameters:
      description - String; the description of the statistic
  • Method Details

    • getFrequency

      public long getFrequency​(java.lang.String key)
      Returns the current counter value for a key
      Parameters:
      key - String; the string key for the counter
      Returns:
      long the counter value
    • getFrequencies

      public java.util.SortedMap<java.lang.String,​java.lang.Long> getFrequencies()
      Returns all counters
      Returns:
      the counter values
    • getN

      public long getN()
      Returns the current number of observations
      Returns:
      long the number of observations
    • count

      public void count​(java.lang.String key, long value)
      count frequency
      Parameters:
      key - String; the key to count the value under
      value - long; the value
    • count

      public void count​(java.lang.String key)
      count 1
      Parameters:
      key - String; key
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
      See Also:
      Object.toString()
    • initialize

      public void initialize()
      initializes the counter
    • isInitialized

      public boolean isInitialized()
      is the counter initialized?
      Returns:
      returns whether the counter is initialized
    • getDescription

      public java.lang.String getDescription()
      returns the description of the counter
      Returns:
      String the description
    • writeToExcel

      public int writeToExcel​(Sheet sheet, int startRow)
      Write statistics to an excel spreadsheet, starting on row "startRow"
      Parameters:
      sheet - Sheet; the excel sheet to write to
      startRow - int; the first row of writing
      Returns:
      first free row after writing