org.jtheque.utils.count
Class Counters

java.lang.Object
  extended by org.jtheque.utils.count.Counters
All Implemented Interfaces:
Iterable<Map.Entry<String,Counter>>

public final class Counters
extends Object
implements Iterable<Map.Entry<String,Counter>>

A collections of counters.

Author:
Baptiste Wicht

Constructor Summary
Counters()
          Construct a new Collection of counters.
 
Method Summary
 void addCounter(String name)
          Add a counter with a specific name to the collection.
 Counter getCounter(String name)
          Return the counter named with the specific name.
 Counter getCounterOrAdd(String name)
          Return the named counter or a new if the counter doesn't exist.
 Iterator<Map.Entry<String,Counter>> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counters

public Counters()
Construct a new Collection of counters.

Method Detail

addCounter

public void addCounter(String name)
Add a counter with a specific name to the collection.

Parameters:
name - The name of the new counter.

getCounter

public Counter getCounter(String name)
Return the counter named with the specific name.

Parameters:
name - The name of the counter we search.
Returns:
The searched counter.

getCounterOrAdd

public Counter getCounterOrAdd(String name)
Return the named counter or a new if the counter doesn't exist.

Parameters:
name - The name of the counter.
Returns:
The searched counter or a new if we doesn't find one counter.

iterator

public Iterator<Map.Entry<String,Counter>> iterator()
Specified by:
iterator in interface Iterable<Map.Entry<String,Counter>>


Copyright © 2010 JTheque. All Rights Reserved.