com.versionone.apiclient

## Class Rank

- java.lang.Object
- - java.lang.Number
  - - com.versionone.apiclient.Rank

- All Implemented Interfaces:
    Serializable, Comparable<Rank>

      public class Rank
      extends Number
      implements Comparable<Rank>

  Rank class used to order assets. Rank has a number and offset. In comparison may act only Ranks with offset == 0. By methods `before()`, `after()` appropriate correlation Ranks can be created.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Rank(Object o)` Creates the Rank equivalent to specified object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Rank` | `after()` Creates Rank with equivalent number and higher offset.
    `Rank` | `before()` Creates Rank with equivalent number and lower offset.
    `int` | `compareTo(Rank other)` Compares this Rank with the specified Rank.
    `double` | `doubleValue()`
    `boolean` | `equals(Object obj)` Compares this object with the specified object.
    `float` | `floatValue()`
    `int` | `hashCode()` Returns a hash code for this `Rank`.
    `int` | `intValue()`
    `boolean` | `isAfter()` Determines if Rank has positive offset
    `boolean` | `isBefore()` Determines if Rank has negative offset
    `long` | `longValue()`
    `String` | `toString()` Returns a string representation of this Rank.

    - ### Methods inherited from class java.lang.Number

      `byteValue, shortValue`

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

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

- - ### Constructor Detail

    - #### Rank

          public Rank(Object o)

      Creates the Rank equivalent to specified object. Object can be instance of:
      - `Rank` - the same Rank
      - `null`, `DB.NullObject` - the highest Rank
      - `String` - must contain integer value with optional end by + or - sign (ex. 5+, 3-). Integer value used for Rank number, sign - for offset.
      - `Number` - Rank with number equivalent to specified value
      - otherwise - Rank equivalent to 0
      Parameters:
        `o` - object to get Rank for

  - ### Method Detail

    - #### before

          public Rank before()

      Creates Rank with equivalent number and lower offset.
      Returns:
        created Rank

    - #### after

          public Rank after()

      Creates Rank with equivalent number and higher offset.
      Returns:
        created Rank

    - #### isBefore

          public boolean isBefore()

      Determines if Rank has negative offset
      Returns:
        true if offset is negative; false otherwise

    - #### isAfter

          public boolean isAfter()

      Determines if Rank has positive offset
      Returns:
        true if offset is positive; false otherwise

    - #### toString

          public String toString()

      Returns a string representation of this Rank. This string consist of integer value and optional + or - sign character. Integer value got from Rank number and appropriate sign from offset. If `(offset == 0)` sign character not added.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string representation of this Rank

    - #### intValue

          public int intValue()

      Specified by:
        `intValue` in class `Number`
      Returns:
        a value of Rank number as `int`.

    - #### longValue

          public long longValue()

      Specified by:
        `longValue` in class `Number`
      Returns:
        a value of Rank number as `long`.

    - #### floatValue

          public float floatValue()

      Specified by:
        `floatValue` in class `Number`
      Returns:
        a value of Rank number as `float`.

    - #### doubleValue

          public double doubleValue()

      Specified by:
        `doubleValue` in class `Number`
      Returns:
        a value of Rank number as `double`.

    - #### equals

          public boolean equals(Object obj)
                         throws IllegalArgumentException

      Compares this object with the specified object. The result is `true` if and only if the argument is not `null` and the `Rank` object that has the same Rank number. Note: Rank objects with offset which isn't 0 cannot be compared. (``isAfter()` == true` or ``isBefore()` == true)`
      Overrides:
        `equals` in class `Object`
      Parameters:
        `obj` - object to compare with.
      Returns:
        `true` if objects equals, `false` otherwise.
      Throws:
        `IllegalArgumentException` - if `obj` or `this` has offset not equal 0.

    - #### hashCode

          public int hashCode()

      Returns a hash code for this `Rank`.
      Overrides:
        `hashCode` in class `Object`
      Returns:
        a hash code value for this Rank, equals to its number.

    - #### compareTo

          public int compareTo(Rank other)
                        throws IllegalArgumentException

      Compares this Rank with the specified Rank. Note: Rank objects with not 0 offset cannot be compared. (``isAfter()` == true` or ``isBefore()` == true)`
      Specified by:
        `compareTo` in interface `Comparable<Rank>`
      Parameters:
        `other` - Rank to compare with.
      Returns:
        the value `0` if this `Rank` is equal to the argument `Rank`; a value less than `0` if this `Rank` number is numerically less than the argument `Rank` number; and the value greater than `0` if this `Rank` number is numerically greater than the argument `Rank` number (signed comparison).
      Throws:
        `IllegalArgumentException` - if `obj` or `this` has offset not equal 0.

Copyright © 2020 VersionOne, Inc.. All rights reserved.