E - the type of elements in this listpublic final class ProofListIndexProxy<E> extends AbstractNativeProxy implements ListIndex<E>
The proof list is implemented as a hash tree (Merkle tree).
The "destructive" methods of the list, i.e., those that change its contents,
are specified to throw UnsupportedOperationException if
this list has been created with a read-only database view.
All method arguments are non-null by default.
This class is not thread-safe and and its instances shall not be shared between threads.
When the view goes out of scope, this list is destroyed. Subsequent use of the closed list
is prohibited and will result in IllegalStateException.
ViewnativeHandle| Modifier and Type | Method and Description |
|---|---|
void |
add(T e)
Adds a new element to the end of the list.
|
void |
addAll(java.util.Collection<? extends T> elements)
Adds all elements from the specified collection to this list.
|
void |
clear()
Clears the list.
|
T |
get(long index)
Returns the element at the given index.
|
T |
getLast()
Returns the last element of the list.
|
java.lang.String |
getName()
Returns the name of this index.
|
java.lang.String |
getName()
Returns the name of this index.
|
com.exonum.binding.storage.proofs.list.ListProof |
getProof(long index)
Returns a proof that an element exists at the specified index in this list.
|
com.exonum.binding.storage.proofs.list.ListProof |
getRangeProof(long from,
long to)
Returns a proof that some elements exist in the specified range in this list.
|
com.exonum.binding.hash.HashCode |
getRootHash()
Returns the root hash of the proof list.
|
boolean |
isEmpty()
Returns true if the list is empty, false — otherwise.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over the elements of the list.
|
static <E> ProofListIndexProxy<E> |
newInGroupUnsafe(java.lang.String groupName,
byte[] listId,
View view,
com.exonum.binding.storage.serialization.Serializer<E> serializer)
Creates a new list in a collection group
with the given name.
|
static <E> ProofListIndexProxy<E> |
newInstance(java.lang.String name,
View view,
com.exonum.binding.storage.serialization.Serializer<E> serializer)
Creates a new ProofListIndexProxy.
|
void |
set(long index,
T e)
Replaces the element at the given index of the list with the specified element.
|
long |
size()
Returns the number of elements in the list.
|
java.lang.String |
toString() |
getNativeHandle, isValidHandleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic static <E> ProofListIndexProxy<E> newInstance(java.lang.String name, View view, com.exonum.binding.storage.serialization.Serializer<E> serializer)
E - the type of elements in this listname - a unique alphanumeric non-empty identifier of this list in the underlying storage:
[a-zA-Z0-9_]view - a database view. Must be valid.
If a view is read-only, "destructive" operations are not permitted.serializer - a serializer of elementsjava.lang.IllegalStateException - if the view is not validjava.lang.IllegalArgumentException - if the name is emptypublic static <E> ProofListIndexProxy<E> newInGroupUnsafe(java.lang.String groupName, byte[] listId, View view, com.exonum.binding.storage.serialization.Serializer<E> serializer)
See a caveat on index identifiers.
E - the type of elements in this listgroupName - a name of the collection grouplistId - an identifier of this collection in the group, see the caveatsview - a database viewserializer - a serializer of list elementsjava.lang.IllegalStateException - if the view is not validjava.lang.IllegalArgumentException - if the name or index id is emptypublic com.exonum.binding.storage.proofs.list.ListProof getProof(long index)
index - the element indexjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.IllegalStateException - if this list is not validpublic com.exonum.binding.storage.proofs.list.ListProof getRangeProof(long from,
long to)
from - the index of the first elementto - the index after the last elementjava.lang.IndexOutOfBoundsException - if the range is not validjava.lang.IllegalStateException - if this list is not validpublic com.exonum.binding.hash.HashCode getRootHash()
java.lang.IllegalStateException - if this list is not validpublic java.lang.String getName()
public final void add(T e)
ListIndexpublic void addAll(java.util.Collection<? extends T> elements)
ListIndexIf the collection contains an invalid element, this list is not modified.
public final void set(long index,
T e)
ListIndexpublic final T get(long index)
ListIndexpublic final T getLast()
ListIndexpublic final void clear()
ListIndexpublic final boolean isEmpty()
ListIndexpublic final long size()
ListIndexpublic final java.util.Iterator<T> iterator()
ListIndexAny destructive operation on the same Fork this list uses
(but not necessarily on this list) will invalidate the iterator.
public final java.lang.String getName()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2018 Exonum. All rights reserved.