VisClient/org/hfbk/util/Counter.java

Go to the documentation of this file.
00001 package org.hfbk.util;
00002 
00003 import java.util.HashMap;
00004 
00013 public class Counter<T> extends HashMap<T, Integer>{
00014         public int total;
00015         public void add(T o){
00016                 if (!containsKey(o))
00017                         put(o,1);
00018                 else
00019                         put(o,get(o)+1);
00020                 total++;
00021         }
00022         public void add(T o, int val){
00023                 if (!containsKey(o))
00024                         put(o,val);
00025                 else
00026                         put(o,get(o)+val);
00027                 total++;
00028         }
00029 
00030 }

Generated on Tue Apr 7 17:57:20 2009 for visclient by  doxygen 1.5.1