Interface Deadline

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 Type
    Method
    Description
    int
    Compares the value of this deadline with that of another deadline.
    boolean
    equals(Object other)
     
    Yields the challenge this deadline responds to.
    long
    Yields the milliseconds to wait for this deadline, assuming the given acceleration.
    Yields the power of this deadline.
    long
    Yields 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[]
    Yields the value of the deadline.
    int
     
    void
    intoWithoutConfigurationData(io.hotmoka.marshalling.api.MarshallingContext context)
    Marshals this object into a given stream.
    boolean
    Determines if this deadline is valid, that is, it is the deadline derived from the corresponding nonce.
    boolean
    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.
    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 to Prolog.getPublicKeyForSigningDeadlines() in the prolog.
      Returns:
      the signature
    • getMillisecondsToWait

      long getMillisecondsToWait(BigInteger acceleration)
      Yields the milliseconds to wait for this deadline, assuming the given acceleration.
      Parameters:
      acceleration - the acceleration
      Returns:
      the milliseconds to wait
    • equals

      boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      int hashCode()
      Overrides:
      hashCode in class Object
    • compareByValue

      int compareByValue(Deadline other)
      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

      boolean signatureIsValid() throws InvalidKeyException, SignatureException
      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 invalid
      SignatureException - 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.
      Overrides:
      toString in class Object
      Returns:
      the string representation