Interface Ranked

All Known Implementing Classes:
Bean, Id

@Deprecated(forRemoval=true) public interface Ranked
Deprecated, for removal: This API element is subject to removal in a future version.
This class is deprecated for future removal.
An interface whose implementations can be ranked numerically in descending order (the highest or greatest rank outranks, or wins, or trumps, or comes first).

In addition, an implementation may be designated as an alternate, which may affect the interpretation of the implementation's rank, usually by conferring a rank that cannot be outranked by any other.

Given a series of Ranked implementations sorted by rank, the first element of the series will bear the highest, or greatest, rank.

Author:
Laird Nelson
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
    The default rank (0) when returned by an implementation of the rank() method.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns true if this Ranked is to be considered an alternate, which may have an effect on how the return value of the rank() method is interpreted in some situations.
    default boolean
    outranks(int j)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns true if this Ranked bears a rank that outranks the rank represented by j according to the rules described in the specification for the outranks(int, int) method.
    static boolean
    outranks(int i, int j)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns true if and only if a rank represented by i outranks a rank represented by j.
    default boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns true if this Ranked outranks the supplied Ranked according to the rules described in the specification for the outranks(int, int) method.
    static boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns true if and only if r0 is non-null and outranks r1.
    default int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the rank of this Ranked implementation.
  • Field Details

    • DEFAULT_RANK

      static final int DEFAULT_RANK
      Deprecated, for removal: This API element is subject to removal in a future version.
      The default rank (0) when returned by an implementation of the rank() method.
      See Also:
  • Method Details

    • rank

      default int rank()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the rank of this Ranked implementation.

      Implementations of this method may return any integer: positive, zero, or negative.

      The default implementation of this method returns the value of the DEFAULT_RANK field (0).

      Overrides of this method must return a determinate value.

      Returns:
      the rank of this Ranked implementation
      See Also:
    • alternate

      default boolean alternate()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns true if this Ranked is to be considered an alternate, which may have an effect on how the return value of the rank() method is interpreted in some situations.

      The default implementation of this method returns false.

      Overrides of this method must be idempotent and return a determinate value.

      Returns:
      true if this Ranked is to be considered an alternate
    • outranks

      default boolean outranks(Ranked other)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns true if this Ranked outranks the supplied Ranked according to the rules described in the specification for the outranks(int, int) method.

      Overriding this method, while possible and permitted, is discouraged.

      Parameters:
      other - a Ranked; may be null (in which case this method will return true)
      Returns:
      true if this Ranked outranks the supplied Ranked
      See Also:
    • outranks

      default boolean outranks(int j)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns true if this Ranked bears a rank that outranks the rank represented by j according to the rules described in the specification for the outranks(int, int) method.

      Overriding this method, while possible and permitted, is discouraged.

      Parameters:
      j - a rank
      Returns:
      true if this Ranked bears a rank that outranks the supplied rank
      See Also:
    • outranks

      static boolean outranks(Ranked r0, Ranked r1)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns true if and only if r0 is non-null and outranks r1.
      Parameters:
      r0 - a Ranked; may be null in which case false will be returned
      r1 - a Ranked; may be null
      Returns:
      true if and only if r0 is non-null and outranks r1
      See Also:
    • outranks

      static boolean outranks(int i, int j)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns true if and only if a rank represented by i outranks a rank represented by j.

      Given two ranks, i and j, i outranks j if and only if i is greater than (>) j.

      Parameters:
      i - an int representing a rank
      j - an int representing a rank
      Returns:
      true if and only if i outranks j
      Idempotency:
      This method is idempotent and deterministic.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.