public class Counter extends Object implements Serializable, Cloneable
Constructor and Description |
---|
Counter()
Construct a Counter.
|
Counter(int count)
Construct a Counter with a starting value.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Return a cloned copy of this object.
|
int |
decrement()
Decrement the counter.
|
boolean |
equals(Object obj)
Check if the given object is equal to this.
|
int |
getCount()
Return the current value of the counter.
|
int |
increment()
Increment the counter.
|
static Counter |
makeDirectional(Counter counter,
boolean increasing)
Returns a directional counter.
|
static Counter |
makeSynchronized(Counter counter)
Return a synchronized counter.
|
void |
reset()
Reset the counter to zero.
|
String |
toString()
Return a string representation of this.
|
public Counter(int count)
count
- Starting value for counter.public Counter()
public int increment()
public int decrement()
public int getCount()
public void reset()
public boolean equals(Object obj)
public String toString()
public Object clone()
public static Counter makeSynchronized(Counter counter)
counter
- Counter to synchronize.Copyright © 2018 JBoss by Red Hat. All rights reserved.