Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

com.arcle.rmt.j2se.util.CounterMap Class Reference

Keeps a mapping of (Object, MutableInteger) to implement a map of counters. More...

List of all members.

Public Member Functions

int getCounter (Object key)
 Returns the value of a counter object, creating the counter if it not yet exists.

int incrementCounter (Object key)
 Increments a counter and returns the new value.


Protected Member Functions

void doIncrementCounter (MutableInteger counter)
 Strategy method that increments a counter's value.

int doGetInitialCounterValue ()
 Strategy method to return the initial value for all newly-created counter.

MutableInteger doGetCounter (Object key)
 Strategy method to that returns a counter object, creating the counter if it not yet exists.

Map getCounters ()
 Returns the counter mappings.

MutableInteger createMutableInteger (int init)
 Factory method that creates the MutableInteger objects used as counters.

Map createCounters ()
 Factory method that creates the Map object used to maintain the counters.


Private Attributes

Map _counters = null
 The (Object, MutableInteger) mapping.


Detailed Description

Keeps a mapping of (Object, MutableInteger) to implement a map of counters.

Author:
Sasmito Adibowo
Version:
Id
CounterMap.java,v 1.4 2003/05/15 19:43:56 adib Exp

Definition at line 69 of file CounterMap.java.


Member Function Documentation

Map com.arcle.rmt.j2se.util.CounterMap.createCounters  )  [protected]
 

Factory method that creates the Map object used to maintain the counters.

Definition at line 155 of file CounterMap.java.

Referenced by com.arcle.rmt.j2se.util.CounterMap.getCounters().

MutableInteger com.arcle.rmt.j2se.util.CounterMap.createMutableInteger int  init  )  [protected]
 

Factory method that creates the MutableInteger objects used as counters.

Parameters:
init the initial value of the mutable integer.

Definition at line 148 of file CounterMap.java.

Referenced by com.arcle.rmt.j2se.util.CounterMap.doGetCounter().

MutableInteger com.arcle.rmt.j2se.util.CounterMap.doGetCounter Object  key  )  [protected]
 

Strategy method to that returns a counter object, creating the counter if it not yet exists.

Parameters:
key the counter.
Returns:
the counter value.

Definition at line 117 of file CounterMap.java.

References com.arcle.rmt.j2se.util.CounterMap.createMutableInteger(), com.arcle.rmt.j2se.util.CounterMap.doGetInitialCounterValue(), and com.arcle.rmt.j2se.util.CounterMap.getCounters().

Referenced by com.arcle.rmt.j2se.util.CounterMap.getCounter(), and com.arcle.rmt.j2se.util.CounterMap.incrementCounter().

int com.arcle.rmt.j2se.util.CounterMap.doGetInitialCounterValue  )  [protected]
 

Strategy method to return the initial value for all newly-created counter.

Returns:
the integer 0.

Definition at line 107 of file CounterMap.java.

Referenced by com.arcle.rmt.j2se.util.CounterMap.doGetCounter().

void com.arcle.rmt.j2se.util.CounterMap.doIncrementCounter MutableInteger  counter  )  [protected]
 

Strategy method that increments a counter's value.

Parameters:
counter the counter to increment.

Definition at line 98 of file CounterMap.java.

References com.arcle.rmt.xplat.util.MutableInteger.value.

Referenced by com.arcle.rmt.j2se.util.CounterMap.incrementCounter().

int com.arcle.rmt.j2se.util.CounterMap.getCounter Object  key  ) 
 

Returns the value of a counter object, creating the counter if it not yet exists.

Parameters:
key the counter.
Returns:
the counter value.

Definition at line 77 of file CounterMap.java.

References com.arcle.rmt.j2se.util.CounterMap.doGetCounter(), and com.arcle.rmt.xplat.util.MutableInteger.value.

Map com.arcle.rmt.j2se.util.CounterMap.getCounters  )  [protected]
 

Returns the counter mappings.

Returns:
a Map containing ordered pairs of (Object, MutableInteger).

Definition at line 134 of file CounterMap.java.

References com.arcle.rmt.j2se.util.CounterMap._counters, and com.arcle.rmt.j2se.util.CounterMap.createCounters().

Referenced by com.arcle.rmt.j2se.util.CounterMap.doGetCounter().

int com.arcle.rmt.j2se.util.CounterMap.incrementCounter Object  key  ) 
 

Increments a counter and returns the new value.

Definition at line 85 of file CounterMap.java.

References com.arcle.rmt.j2se.util.CounterMap.doGetCounter(), com.arcle.rmt.j2se.util.CounterMap.doIncrementCounter(), and com.arcle.rmt.xplat.util.MutableInteger.value.


Member Data Documentation

Map com.arcle.rmt.j2se.util.CounterMap._counters = null [private]
 

The (Object, MutableInteger) mapping.

Definition at line 165 of file CounterMap.java.

Referenced by com.arcle.rmt.j2se.util.CounterMap.getCounters().


The documentation for this class was generated from the following file:
Generated on Fri Jun 18 19:55:00 2004 for Arcle Rambutan by doxygen 1.3.5