1 22 package org.jboss.management.j2ee.statistics; 23 24 import javax.management.j2ee.statistics.CountStatistic ; 25 26 33 public class CountStatisticImpl 34 extends StatisticImpl 35 implements CountStatistic 36 { 37 41 42 private static final long serialVersionUID = 8087661344599547469L; 43 44 protected long count; 48 49 53 60 public CountStatisticImpl(String name, String units, String description) 61 { 62 super(name, units, description); 63 } 64 65 69 72 public long getCount() 73 { 74 return count; 75 } 76 77 80 public String toString() 81 { 82 return "[ " + getCount() + ":" + super.toString() + " ]"; 83 } 84 85 89 92 public void add() 93 { 94 set(++count); 95 } 96 97 100 public void remove() 101 { 102 if (count > 0) 103 { 104 set(--count); 105 } 106 } 107 108 111 public void reset() 112 { 113 count = 0; 114 super.reset(); 115 } 116 117 122 public void set(long count) 123 { 124 this.count = count; 125 super.set(); 126 } 127 } 128 | Popular Tags |