Class CheckedListProofImpl<E>
java.lang.Object
com.exonum.binding.common.proofs.list.CheckedListProofImpl<E>
- All Implemented Interfaces:
CheckedProof
,CheckedListProof<E>
public class CheckedListProofImpl<E> extends java.lang.Object implements CheckedListProof<E>
A checked list proof includes list proof verification results.
If it is correct you may access:
- a calculated index hash of corresponding collection
- proof elements
If the proof is the proof of absence, then empty collection of elements is returned.
If the proof is not valid, you may get the verification status using
getProofStatus()
with description of why the proof is not
valid.
-
Constructor Summary
Constructors Constructor Description CheckedListProofImpl(long size, HashCode calculatedIndexHash, java.util.NavigableMap<java.lang.Long,E> elements, ListProofStatus proofStatus)
Creates checked list proof. -
Method Summary
Modifier and Type Method Description java.util.NavigableMap<java.lang.Long,E>
getElements()
Get all list proof elements.HashCode
getIndexHash()
Returns the calculated index hash of the proof.ListProofStatus
getProofStatus()
Returns the status of this proof: whether it is structurally valid.boolean
isValid()
Returns true if proof status is valid, false otherwise.long
size()
Returns the size of the list: the total number of elements in it.
-
Constructor Details
-
CheckedListProofImpl
public CheckedListProofImpl(long size, HashCode calculatedIndexHash, java.util.NavigableMap<java.lang.Long,E> elements, ListProofStatus proofStatus)Creates checked list proof.- Parameters:
calculatedIndexHash
- calculated index hash of the proofelements
- proof elements collection (empty in case of a proof of absence)proofStatus
- a status of proof verification
-
-
Method Details
-
size
public long size()Description copied from interface:CheckedListProof
Returns the size of the list: the total number of elements in it.- Specified by:
size
in interfaceCheckedListProof<E>
-
getElements
Description copied from interface:CheckedListProof
Get all list proof elements. There might be several consecutive ranges.- Specified by:
getElements
in interfaceCheckedListProof<E>
- Returns:
- list proof elements. Empty if the proof is a proof of absence
-
getIndexHash
Description copied from interface:CheckedProof
Returns the calculated index hash of the proof. Must be equal to the index hash of the collection, providing this proof.- Specified by:
getIndexHash
in interfaceCheckedProof
-
getProofStatus
Description copied from interface:CheckedListProof
Returns the status of this proof: whether it is structurally valid.- Specified by:
getProofStatus
in interfaceCheckedListProof<E>
- Specified by:
getProofStatus
in interfaceCheckedProof
-
isValid
public boolean isValid()Description copied from interface:CheckedProof
Returns true if proof status is valid, false otherwise. Details about the proof verification status could be obtained viaCheckedProof.getProofStatus()
.- Specified by:
isValid
in interfaceCheckedProof
-