- All Superinterfaces:
io.hotmoka.marshalling.api.Marshallable
public interface Deadline
extends io.hotmoka.marshalling.api.Marshallable
A deadline derived from a nonce. It identifies a nonce
and a value computed from that nonce. Deadlines are ordered
by the lexicographical ordering of their values.
-
Method Summary
Modifier and TypeMethodDescriptionintcompareByValue(Deadline other) Compares the value of this deadline with that of another deadline.booleanYields the challenge this deadline responds to.longgetMillisecondsToWait(BigInteger acceleration) Yields the milliseconds to wait for this deadline, assuming the given acceleration.getPower()Yields the power of this deadline.longYields the progressive number of the nonce of the deadline.Yields the prolog that was used to create the nonce from which this deadline has been generated.byte[]The signature of the deadline.byte[]getValue()Yields the value of the deadline.inthashCode()voidintoWithoutConfigurationData(io.hotmoka.marshalling.api.MarshallingContext context) Marshals this object into a given stream.booleanisValid()Determines if this deadline is valid, that is, it is the deadline derived from the corresponding nonce.booleanDetermines if the signature of this deadline is valid, that is, it is a correct signature of this deadline with the key in the prolog.toString()Yields a string representation of this deadline.Methods inherited from interface io.hotmoka.marshalling.api.Marshallable
into, size, toByteArray
-
Method Details
-
getProlog
Prolog getProlog()Yields the prolog that was used to create the nonce from which this deadline has been generated.- Returns:
- the prolog
-
getProgressive
long getProgressive()Yields the progressive number of the nonce of the deadline.- Returns:
- the progressive number
-
getValue
byte[] getValue()Yields the value of the deadline.- Returns:
- the value
-
getChallenge
Challenge getChallenge()Yields the challenge this deadline responds to.- Returns:
- the challenge this deadline responds to
-
getSignature
byte[] getSignature()The signature of the deadline. This has been computed with the private key corresponding toProlog.getPublicKeyForSigningDeadlines()in the prolog.- Returns:
- the signature
-
getMillisecondsToWait
Yields the milliseconds to wait for this deadline, assuming the given acceleration.- Parameters:
acceleration- the acceleration- Returns:
- the milliseconds to wait
-
equals
-
hashCode
int hashCode() -
compareByValue
Compares the value of this deadline with that of another deadline. They are assumed to have been generated with the same hashing algorithm.- Parameters:
other- the other deadline- Returns:
- negative if the value of this deadline is smaller than the value of the other deadline; positive if the value of this deadline if larger than the value of the other deadline; 0 if the value are equal
-
isValid
boolean isValid()Determines if this deadline is valid, that is, it is the deadline derived from the corresponding nonce.- Returns:
- true if and only if this deadline is valid
-
signatureIsValid
Determines if the signature of this deadline is valid, that is, it is a correct signature of this deadline with the key in the prolog. derived from the corresponding nonce.- Returns:
- true if and only if the signature of this deadline is valid
- Throws:
InvalidKeyException- if the key in the prolog of this deadline is invalidSignatureException- if the signature in this deadline cannot be verified
-
getPower
BigInteger getPower()Yields the power of this deadline. This is the ratio between the worst possible deadline value and the actual deadline value.- Returns:
- the power of this deadline
-
intoWithoutConfigurationData
void intoWithoutConfigurationData(io.hotmoka.marshalling.api.MarshallingContext context) throws IOException Marshals this object into a given stream. This method in general performs better than standard Java serialization, wrt the size of the marshalled data. It does not marshal information that can be recovered from the configuration of a Mokamint node storing this deadline.- Parameters:
context- the context holding the stream- Throws:
IOException- if this object cannot be marshalled
-
toString
String toString()Yields a string representation of this deadline.
-