Top Description Methods
net.sf.ehcache.util.counter

public Interface Counter

Known Direct Subinterfaces
net.sf.ehcache.util.counter.sampled.SampledCounter
Known Direct Implementers
net.sf.ehcache.util.counter.CounterImpl

A simple counter
Author
Abhishek Sanoujam
Since
1.7

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the value after decrementing
decrement
()

Decrement the counter by 1

public long

Returns:

the value of the counter after decrementing
decrement
(long amount)

Decrement the counter by given amount

public long

Returns:

Returns the old value
getAndSet
(long newValue)

Returns the value of the counter and sets it to the new value

public long

Returns:

current value of the counter
getValue
()

Gets current value of the counter

public long

Returns:

the value after incrementing
increment
()

Increment the counter by 1

public long

Returns:

the value of the counter after incrementing
increment
(long amount)

Increment the counter by given amount

public void
setValue(long newValue)

Sets the value of the counter to the supplied value

Method Detail

decrementback to summary
public long decrement()

Decrement the counter by 1

Returns:long

the value after decrementing

decrementback to summary
public long decrement(long amount)

Decrement the counter by given amount

Returns:long

the value of the counter after decrementing

getAndSetback to summary
public long getAndSet(long newValue)

Returns the value of the counter and sets it to the new value

Returns:long

Returns the old value

getValueback to summary
public long getValue()

Gets current value of the counter

Returns:long

current value of the counter

incrementback to summary
public long increment()

Increment the counter by 1

Returns:long

the value after incrementing

incrementback to summary
public long increment(long amount)

Increment the counter by given amount

Returns:long

the value of the counter after incrementing

setValueback to summary
public void setValue(long newValue)

Sets the value of the counter to the supplied value