public class IdentifierArray
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Identifier[] |
identifiers |
Constructor and Description |
---|
IdentifierArray()
Constructs a new int array with the default capacity of 500 items.
|
IdentifierArray(int baseCapacity)
Constructs a new int array with the specified capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Identifier newIdentifier)
Adds an item to the array
|
void |
add(Identifier newIdentifier,
int itemIndex,
int maxRows)
Inserts an identifier
|
Identifier[] |
doubleCapacity(Identifier[] oldIdentifierArray)
Doubles the capacity of an Identifier array.
|
Identifier |
getIdentifier(int item)
Returns the value of an item.
|
void |
init()
Initializes the array.
|
void |
remove(int itemIndex)
Removes an item and closes the gap.
|
void |
setIdentifier(int item,
Identifier identifier)
Sets the value of an item.
|
public Identifier[] identifiers
public IdentifierArray()
public IdentifierArray(int baseCapacity)
baseCapacity
- the initial capacitypublic void init()
public void add(Identifier newIdentifier)
newIdentifier
- the identifier to insertpublic void add(Identifier newIdentifier, int itemIndex, int maxRows)
newIdentifier
- the identifier to insertitemIndex
- index (position of the identifier to insert)maxRows
- the maximum of rows to be hold in the array - last item will vanish if size > maxRowspublic void remove(int itemIndex)
itemIndex
- the index of the item to be removedpublic void setIdentifier(int item, Identifier identifier)
item
- the index of the item to setintValue
- the new int valuepublic Identifier getIdentifier(int item)
item
- the index of the regarded itempublic Identifier[] doubleCapacity(Identifier[] oldIdentifierArray)
oldintArray
- the int array to double capacityCopyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de