In addition, an implementation may be designated as an alternate, which may affect the interpretation of the implementation's rank.
Given a series of Ranked
implementations sorted by rank, the first element of the
series will bear the greatest rank.
- Author:
- Laird Nelson
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default rank (0) when returned by an implementation of therank()
method. -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
default boolean
outranks
(int j) Returnstrue
if thisRanked
bears a rank that outranks the rank represented byj
according to the rules described in the specification for theoutranks(int, int)
method.static boolean
outranks
(int i, int j) Returnstrue
if and only if a rank represented byi
outranks a rank represented byj
.default boolean
Returnstrue
if thisRanked
outranks the suppliedRanked
according to the rules described in the specification for theoutranks(int, int)
method.static boolean
default int
rank()
Returns the rank of thisRanked
implementation.
-
Field Details
-
DEFAULT_RANK
The default rank (0) when returned by an implementation of therank()
method.- See Also:
-
-
Method Details
-
rank
Returns the rank of thisRanked
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
Returnstrue
if thisRanked
is to be considered an alternate, which may have an effect on how the return value of therank()
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 thisRanked
is to be considered an alternate
-
outranks
Returnstrue
if thisRanked
outranks the suppliedRanked
according to the rules described in the specification for theoutranks(int, int)
method.Overriding this method, while possible and permitted, is discouraged.
-
outranks
Returnstrue
if thisRanked
bears a rank that outranks the rank represented byj
according to the rules described in the specification for theoutranks(int, int)
method.Overriding this method, while possible and permitted, is discouraged.
-
outranks
-
outranks
Returnstrue
if and only if a rank represented byi
outranks a rank represented byj
.Given two ranks, i and j, i outranks j if and only if i is greater than (
>
) j.- Parameters:
i
- anint
representing a rankj
- anint
representing a rank- Returns:
true
if and only ifi
outranksj
- Idempotency:
- This method is idempotent and deterministic.
- Thread Safety:
- This method is safe for concurrent use by multiple threads.
-