ca.infoway.messagebuilder.j5goodies
Class Counter<T extends Comparable<T>>

Package class diagram package Counter
java.lang.Object
  extended by ca.infoway.messagebuilder.j5goodies.Counter<T>
Type Parameters:
T - - a comparable type of thing to be counted.

public class Counter<T extends Comparable<T>>
extends Object

A class that counts references to a particular type, T.

Author:
Intelliware Development

Constructor Summary
Counter()
           
 
Method Summary
 int get(T t)
          Get the number of times the instance, t, was counted.
 List<Tally<T>> getAll(CounterOrder order)
          Get a list of tallies or counts of each item tracked.
 int getTotal()
          Get the total number of instances counted.
 void increment(T t)
          Increment the number of instances of 't' by one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

public Counter()
Method Detail

increment

public void increment(T t)

Increment the number of instances of 't' by one.

Parameters:
t - - the instance being counted.

getAll

public List<Tally<T>> getAll(CounterOrder order)

Get a list of tallies or counts of each item tracked.

Parameters:
order - - either ascending or descending (null is equivalent to ascending).
Returns:
- the list of all final tallies, ordered as requested.

get

public int get(T t)

Get the number of times the instance, t, was counted.

Parameters:
t - - the instance.
Returns:
- the count

getTotal

public int getTotal()

Get the total number of instances counted.

Returns:
- the count


Copyright © 2013. All Rights Reserved.