public class UniqueIdTable extends Object
Constructor and Description |
---|
UniqueIdTable(int size)
Creates a new UniqueIdTable given a size, which will be the maximum number
of objects that can be stored and associated with unique id numbers.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this UniqueIdTable.
|
Object |
get(int id)
Returns the object that is associated with the given id,
or null if there is no such object.
|
boolean |
isFull()
Returns true if no more objects can be stored in this UniqueIdTable and
associated with a unique id number.
|
int |
put(Object object)
Stores an object in this UniqueIdTable,
giving the object a unique id number.
|
Object |
remove(int id)
Removes the object that is associated with the given id from this
UniqueIdTable.
|
Enumeration |
uniqueIds()
Returns an Enumeration of the unique id numbers
that map to objects in this UniqueIdTable.
|
public UniqueIdTable(int size)
size
- the size of the new UniqueIdTable.public void clear()
public int put(Object object) throws TooManyItemsException
TooManyItemsException
- if this UniqueIdTable is full.public Object get(int id)
id
- an id number.public Enumeration uniqueIds()
public Object remove(int id)
public boolean isFull()
Copyright © 2023. All rights reserved.