- All Superinterfaces:
DeadlineDescription,io.hotmoka.marshalling.api.Marshallable
A deadline inside a plot file. It is a reference to a nonce
and a value computed for that nonce. Deadlines are ordered
by the lexicographical ordering of their values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximal length of the prolog of a deadline, in bytes (inclusive).static final intThe maximal scoop number in a deadline (inclusive). -
Method Summary
Modifier and TypeMethodDescriptionintcompareByValue(Deadline other) Compares the value of this deadline with that of another deadline.booleanChecks if this deadline is equal to another object (same progressive, same value).longYields the progressive number of the nonce of the deadline.byte[]Yields the prolog that was used to create the plot file from which this deadline has been generated.byte[]getValue()Yields the value of the deadline computed for the noncegetProgressive()of the plot file.booleanisValid()Determines if this deadline is valid, that is, its corresponding nonce is for the same deadline.booleanmatches(DeadlineDescription description) Determines if this deadline matches the given description: same scoop number, same data and same hashing algorithm.toString()Yields a string representation of this deadline.Methods inherited from interface io.mokamint.nonce.api.DeadlineDescription
getData, getHashing, getScoopNumberMethods inherited from interface io.hotmoka.marshalling.api.Marshallable
into, toByteArray
-
Field Details
-
MAX_PROLOG_SIZE
static final int MAX_PROLOG_SIZEThe maximal length of the prolog of a deadline, in bytes (inclusive).- See Also:
-
MAX_SCOOP_NUMBER
static final int MAX_SCOOP_NUMBERThe maximal scoop number in a deadline (inclusive).- See Also:
-
-
Method Details
-
getProlog
byte[] getProlog()Yields the prolog that was used to create the plot file 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 computed for the noncegetProgressive()of the plot file.- Returns:
- the value
-
equals
Checks if this deadline is equal to another object (same progressive, same value). -
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
-
matches
Determines if this deadline matches the given description: same scoop number, same data and same hashing algorithm.- Parameters:
description- the description matched to this deadline- Returns:
- true if and inly if that condition holds
-
isValid
boolean isValid()Determines if this deadline is valid, that is, its corresponding nonce is for the same deadline.- Returns:
- true if and only if this deadline is valid
-
toString
String toString()Yields a string representation of this deadline.- Specified by:
toStringin interfaceDeadlineDescription- Overrides:
toStringin classObject- Returns:
- the string representation
-