Package qilin.util
Interface Numberer<E>
- All Known Subinterfaces:
IterableNumberer<E>
- All Known Implementing Classes:
ArrayNumberer
,StringNumberer
public interface Numberer<E>
A numberer converts objects to unique non-negative integers, and vice-versa.
- Author:
- xiao, generalize the interface
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Tells the numberer that a new object needs to be assigned a number.get
(long number) Should return the object that was assigned the number.long
Should return the number that was assigned to object o that was previously passed as an argument to add().boolean
Removes the number for a given object.int
size()
Should return the number of objects that have been assigned numbers.
-
Method Details
-
add
Tells the numberer that a new object needs to be assigned a number. -
remove
Removes the number for a given object.- Parameters:
o
- the element- Returns:
- true if the removal was successful, false when not
-
get
Should return the number that was assigned to object o that was previously passed as an argument to add(). -
get
Should return the object that was assigned the number. -
size
int size()Should return the number of objects that have been assigned numbers.
-