SequentialNumber (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util, class: SequentialNumber

Package org.apache.hadoop.util

# Class SequentialNumber

java.lang.Object
org.apache.hadoop.util.SequentialNumber

All Implemented Interfaces:
  `IdGenerator`

@Private public abstract class SequentialNumber extends Object implements IdGenerator
Sequential number generator. This class is thread safe.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `SequentialNumber(long initialValue)`
  Create a new instance with the given initial value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object that)`
  `long`
  `getCurrentValue()`
  `int`
  `hashCode()`
  `long`
  `nextValue()`
  Increment and then return the next value.
  `void`
  `setCurrentValue(long value)`
  Set current value.
  `boolean`
  `setIfGreater(long value)`
  `void`
  `skipTo(long newValue)`
  Skip to the new value.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SequentialNumber

    protected SequentialNumber(long initialValue)
    Create a new instance with the given initial value.
    Parameters:
      `initialValue` - initialValue.

- ## Method Details

  - ### getCurrentValue

    public long getCurrentValue()
    Returns:
      the current value.

  - ### setCurrentValue

    public void setCurrentValue(long value)
    Set current value.
    Parameters:
      `value` - value.

  - ### setIfGreater

    public boolean setIfGreater(long value)

  - ### nextValue

    public long nextValue()
    Increment and then return the next value.
    Specified by:
      `nextValue` in interface `IdGenerator`
    Returns:
      long value.

  - ### skipTo

    public void skipTo(long newValue) throws IllegalStateException
    Skip to the new value.
    Parameters:
      `newValue` - newValue.
    Throws:
      `IllegalStateException` - Cannot skip to less than the current value.

  - ### equals

    public boolean equals(Object that)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`