org.onemind.commons.java.util
Class Counter

java.lang.Object
  extended byorg.onemind.commons.java.util.Counter

public class Counter
extends java.lang.Object

For counting things

Version:
$Id: Counter.java,v 1.2 2005/06/22 22:58:25 thlee Exp $ $Name: $
Author:
TiongHiang Lee (thlee@onemindsoft.org)

Constructor Summary
Counter()
          Constructor
 
Method Summary
 void count(java.lang.Object counted)
          Add count.
 void count(java.lang.Object counted, long countValue)
          Adjust count by value
 void dump(java.io.Writer writer)
          Dump to output
 long getCount(java.lang.Object counted)
          Get the count
 void removeCount(java.lang.Object counted)
          Remove the count.
 void resetAll()
          Reset all the counters
 void resetCount(java.lang.Object counted)
          Reset the count for counted
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Counter

public Counter()
Constructor

Method Detail

count

public void count(java.lang.Object counted)
Add count. Count as 1 if it is not counted before

Parameters:
counted -

count

public void count(java.lang.Object counted,
                  long countValue)
Adjust count by value

Parameters:
counted - the counted
countValue - the count value

removeCount

public void removeCount(java.lang.Object counted)
Remove the count. Count as -1 if it is not counted before

Parameters:
counted - the counted

getCount

public long getCount(java.lang.Object counted)
Get the count

Parameters:
counted - the counted
Returns:
the count

dump

public void dump(java.io.Writer writer)
          throws java.io.IOException
Dump to output

Parameters:
writer - the writer
Throws:
java.io.IOException

resetCount

public void resetCount(java.lang.Object counted)
Reset the count for counted

Parameters:
counted - the counted

resetAll

public void resetAll()
Reset all the counters


toString

public java.lang.String toString()


Copyright © 2004-2006 . All Rights Reserved.