public final class Index extends Object implements Position
Modifier and Type | Field and Description |
---|---|
int |
n
The index number.
|
Modifier and Type | Method and Description |
---|---|
Index |
asIndex()
Returns this index.
|
Key |
asKey()
throws an UserError exception.
|
int |
compareTo(Position o)
Compares this index with another given position.
|
boolean |
equals(Object that)
Returns true if that is an index and both have the same value.
|
int |
hashCode()
Returns the hashcode of this index.
|
boolean |
isIndex()
Returns true.
|
boolean |
isKey()
Returns false.
|
static Index |
of(int index)
Returns a new instance witch represents the given index in an array.
|
String |
toString()
Returns the value of the index as a string.
|
public static Index of(int index)
index
- the given positionIndexOutOfBoundsException
- if the index is less than -1public int compareTo(Position o)
compareTo
in interface Comparable<Position>
o
- the given positionpublic Key asKey()
public Index asIndex()
public boolean isIndex()
public boolean isKey()
public int hashCode()
public boolean equals(Object that)
Copyright © 2022. All rights reserved.