Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.util
Class Counter

    java.lang.Object
      org.jboss.util.Counter

All Implemented Interfaces:
  Cloneable, Serializable

public class Counter
extends Object
implements Serializable, Cloneable

An integer counter class.

Version:
  `$Revision: 1.1 $`
Author:
  Jason Dillon
See Also:
  Serialized Form

Constructor Summary
`Counter()` Construct a Counter.
`Counter(int count)` Construct a Counter with a starting value.

Method Summary
`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.

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Counter

    public Counter(int count)

  Construct a Counter with a starting value.

Parameters:
  `count` - Starting value for counter.

### Counter

    public Counter()

  Construct a Counter.

Method Detail

### increment

    public int increment()

  Increment the counter. (Optional operation)

  Returns:
    The incremented value of the counter.

### decrement

    public int decrement()

  Decrement the counter. (Optional operation)

  Returns:
    The decremented value of the counter.

### getCount

    public int getCount()

  Return the current value of the counter.

  Returns:
    The current value of the counter.

### reset

    public void reset()

  Reset the counter to zero. (Optional operation)

### equals

    public boolean equals(Object obj)

  Check if the given object is equal to this.

  Parameters:
    `obj` - Object to test equality with.
  Returns:
    True if object is equal to this.

### toString

    public String toString()

  Return a string representation of this.

  Returns:
    A string representation of this.

### clone

    public Object clone()

  Return a cloned copy of this object.

  Returns:
    A cloned copy of this object.

### makeSynchronized

    public static Counter makeSynchronized(Counter counter)

  Return a synchronized counter.

  Parameters:
    `counter` - Counter to synchronize.
  Returns:
    Synchronized counter.

### makeDirectional

    public static Counter makeDirectional(Counter counter,
                                          boolean increasing)

  Returns a directional counter.

  Parameters:
    `counter` - Counter to make directional.
    `increasing` - True to create an increasing only or false to create a decreasing only.
  Returns:
    A directional counter.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.