E - the element typepublic abstract class AbstractBucket<E> extends AbstractSet<E> implements Bucket<E>
Bucket.| Modifier and Type | Field and Description |
|---|---|
protected Set<E> |
content
The content in the bucket
|
protected ImmutableList<Set<E>> |
partitions
The partitions in the bucket
|
protected ImmutableList<BucketPartition<E>> |
partitionView
A view of the
partitions list - with all contained values wrapped by SetView. |
protected int |
size
The number of partitions in this bucket
|
protected PartitioningStrategy<E> |
strategy
The function used to partition objects
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBucket(int size,
PartitioningStrategy<E> strategy) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
Cycle<BucketPartition<E>> |
asCycle()
Returns a cycle instance unique to this bucket.
|
void |
clear() |
boolean |
contains(Object o) |
protected abstract Set<E> |
createSet()
Supplies the set instances to use for each partition in the bucket
|
BucketPartition<E> |
getPartition(int index)
Gets the partition with the given index value
|
int |
getPartitionCount()
Gets the number of partitions used to form this bucket.
|
List<BucketPartition<E>> |
getPartitions()
Gets the partitions which form this bucket.
|
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object o) |
int |
size() |
equals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, removeAll, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streamprotected final PartitioningStrategy<E> strategy
protected final int size
protected final ImmutableList<Set<E>> partitions
protected final ImmutableList<BucketPartition<E>> partitionView
partitions list - with all contained values wrapped by SetView.protected AbstractBucket(int size,
PartitioningStrategy<E> strategy)
protected abstract Set<E> createSet()
public int getPartitionCount()
BucketgetPartitionCount in interface Bucket<E>@Nonnull public BucketPartition<E> getPartition(int index)
BucketgetPartition in interface Bucket<E>index - the partition index@Nonnull public List<BucketPartition<E>> getPartitions()
BucketgetPartitions in interface Bucket<E>@Nonnull public Cycle<BucketPartition<E>> asCycle()
BucketThis method is provided as a utility for operating deterministically on all elements within the bucket over a period of time.
The same cycle instance is returned for each bucket.
public boolean add(E e)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>public void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class AbstractCollection<E>public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>isEmpty in class AbstractCollection<E>public boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>Copyright © 2020. All rights reserved.