Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/entry/CountersImpl.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz.entry; | |
2 | |
3 /** | |
4 Manages operation and instance counters | |
5 */ | |
6 class CountersImpl implements Counters { | |
7 private OpSwitchListener theOpSwitchListener; | |
8 private InstanceSwitchListener theInstanceSwitchListener; | |
9 | |
10 CountersImpl(String aType, int anInitialCount) { | |
11 theOpSwitchListener = new OpSwitchListener(aType); | |
12 theInstanceSwitchListener = | |
13 new InstanceSwitchListener(aType, anInitialCount); | |
14 } | |
15 | |
16 public int getInstanceCount() { | |
17 return theInstanceSwitchListener.getTotal(); | |
18 } | |
19 | |
20 public void didRead() { | |
21 // Reads are only relevant to op counts not instance counts | |
22 theOpSwitchListener.didRead(); | |
23 } | |
24 | |
25 public void didTake() { | |
26 theOpSwitchListener.didTake(); | |
27 theInstanceSwitchListener.took(); | |
28 } | |
29 | |
30 public void didWrite() { | |
31 theOpSwitchListener.didWrite(); | |
32 theInstanceSwitchListener.wrote(); | |
33 } | |
34 | |
35 public void didPurge() { | |
36 theInstanceSwitchListener.took(); | |
37 } | |
38 | |
39 void destroy() { | |
40 theOpSwitchListener.destroy(); | |
41 theInstanceSwitchListener.destroy(); | |
42 } | |
43 } |