E - the type of the elements in the setspublic class ArraySlicedSet<E> extends Object
HashMap.
[1] Donald E. Knuth, The Art of Computer Programming, Volume 3, Sorting and
Searching, Second Edition| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_SLICES
the maximal number of slices that can be stored in a
ArraySlicedSet |
| Constructor and Description |
|---|
ArraySlicedSet(int slices) |
ArraySlicedSet(int slices,
int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int s,
E e)
Inserts a given element into the given slice
|
void |
clear()
Clears all slices of this
ArraySlicedSet. |
boolean |
contains(int s,
Object o) |
Set<E> |
getSlice(int s) |
boolean |
isEmpty(int s) |
boolean |
remove(int s,
Object o)
Removes the given object from the given slice
|
boolean |
removeAll(int s,
Collection<?> c)
Removes all element of the given
Collection from the given slice |
int |
size(int s) |
public static int MAX_SLICES
ArraySlicedSetpublic ArraySlicedSet(int slices,
int initialCapacity)
public ArraySlicedSet(int slices)
public int size(int s)
s - the slice idpublic boolean isEmpty(int s)
s - the slice idtrue if the given slice does not contain any elements and
false otherwisepublic boolean contains(int s,
Object o)
public boolean add(int s,
E e)
s - the slice ide - the elements to be inserted in to the given slicetrue if the given element did not occur in the given
slice and thus was inserted. Otherwise false is returned
and nothing is modified.public boolean remove(int s,
Object o)
s - the slice ido - the object that should be removed from the given slicetrue if the given object is equal to some element of the
given slice; this element will be removed from the slice. If
there is no such an object, false is returned and nothing
is modifiedpublic boolean removeAll(int s,
Collection<?> c)
Collection from the given slices - the slice idc - the collection whose elements should be removedtrue if at least one element is removed from the slice.
An element is removed if an equal element is present in the given
collection. If no elements are removed, false is returned
and nothing is modified.public void clear()
ArraySlicedSet. After calling this
methods, all slices are empty.public Set<E> getSlice(int s)
s - the slice idArraySlicedSet; it can be modifiedCopyright © 2011–2024 Live Ontologies Project. All rights reserved.