org.jjoost.util
Class Counters.DontCounter

java.lang.Object
  extended by org.jjoost.util.Counters.DontCounter
All Implemented Interfaces:
Counter
Enclosing class:
Counters

public static class Counters.DontCounter
extends java.lang.Object
implements Counter

a Counter which ignores all updates to its value and always returns a value less than zero.

Author:
b.elliottsmith

Constructor Summary
Counters.DontCounter()
           
 
Method Summary
 boolean add(int i)
          returns true if adding the provided integer does not reduce the value to below zero; if true then the value was added to the Counter
 int get()
          Gets the current value of the Counter
 Counter newInstance()
          returns a new Counter of the same type as this one, with a value of zero
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counters.DontCounter

public Counters.DontCounter()
Method Detail

add

public boolean add(int i)
Description copied from interface: Counter
returns true if adding the provided integer does not reduce the value to below zero; if true then the value was added to the Counter

Specified by:
add in interface Counter
Parameters:
i - to add
Returns:
true, if successful

get

public int get()
Description copied from interface: Counter
Gets the current value of the Counter

Specified by:
get in interface Counter
Returns:
current value

newInstance

public Counter newInstance()
Description copied from interface: Counter
returns a new Counter of the same type as this one, with a value of zero

Specified by:
newInstance in interface Counter
Returns:
new Counter