Class BLProgressUpdate

java.lang.Object
com.io7m.brooklime.api.BLProgressUpdate
All Implemented Interfaces:
BLProgressEventType, BLProgressEventType.BLProgressUpdateType

public final class BLProgressUpdate
extends java.lang.Object
implements BLProgressEventType.BLProgressUpdateType
Immutable implementation of BLProgressEventType.BLProgressUpdateType.

Use the builder to create immutable instances: BLProgressUpdate.builder().

  • Method Details

    • name

      public java.lang.String name()
      Specified by:
      name in interface BLProgressEventType
      Specified by:
      name in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the name attribute
    • fileIndexCurrent

      public int fileIndexCurrent()
      Specified by:
      fileIndexCurrent in interface BLProgressEventType
      Specified by:
      fileIndexCurrent in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the fileIndexCurrent attribute
    • fileIndexMaximum

      public int fileIndexMaximum()
      Specified by:
      fileIndexMaximum in interface BLProgressEventType
      Specified by:
      fileIndexMaximum in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the fileIndexMaximum attribute
    • attemptCurrent

      public int attemptCurrent()
      Specified by:
      attemptCurrent in interface BLProgressEventType
      Specified by:
      attemptCurrent in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the attemptCurrent attribute
    • attemptMaximum

      public int attemptMaximum()
      Specified by:
      attemptMaximum in interface BLProgressEventType
      Specified by:
      attemptMaximum in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the attemptMaximum attribute
    • bytesSent

      public long bytesSent()
      Specified by:
      bytesSent in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the bytesSent attribute
    • bytesMaximum

      public long bytesMaximum()
      Specified by:
      bytesMaximum in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the bytesMaximum attribute
    • progress

      public double progress()
      Specified by:
      progress in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the progress attribute
    • bytesPerSecond

      public long bytesPerSecond()
      Specified by:
      bytesPerSecond in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the bytesPerSecond attribute
    • timeRemaining

      public java.time.Duration timeRemaining()
      Specified by:
      timeRemaining in interface BLProgressEventType.BLProgressUpdateType
      Returns:
      The value of the timeRemaining attribute
    • withName

      public final BLProgressUpdate withName​(java.lang.String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy of the this object
    • withFileIndexCurrent

      public final BLProgressUpdate withFileIndexCurrent​(int value)
      Copy the current immutable object by setting a value for the fileIndexCurrent attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for fileIndexCurrent
      Returns:
      A modified copy of the this object
    • withFileIndexMaximum

      public final BLProgressUpdate withFileIndexMaximum​(int value)
      Copy the current immutable object by setting a value for the fileIndexMaximum attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for fileIndexMaximum
      Returns:
      A modified copy of the this object
    • withAttemptCurrent

      public final BLProgressUpdate withAttemptCurrent​(int value)
      Copy the current immutable object by setting a value for the attemptCurrent attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for attemptCurrent
      Returns:
      A modified copy of the this object
    • withAttemptMaximum

      public final BLProgressUpdate withAttemptMaximum​(int value)
      Copy the current immutable object by setting a value for the attemptMaximum attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for attemptMaximum
      Returns:
      A modified copy of the this object
    • withBytesSent

      public final BLProgressUpdate withBytesSent​(long value)
      Copy the current immutable object by setting a value for the bytesSent attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for bytesSent
      Returns:
      A modified copy of the this object
    • withBytesMaximum

      public final BLProgressUpdate withBytesMaximum​(long value)
      Copy the current immutable object by setting a value for the bytesMaximum attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for bytesMaximum
      Returns:
      A modified copy of the this object
    • withProgress

      public final BLProgressUpdate withProgress​(double value)
      Copy the current immutable object by setting a value for the progress attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for progress
      Returns:
      A modified copy of the this object
    • withBytesPerSecond

      public final BLProgressUpdate withBytesPerSecond​(long value)
      Copy the current immutable object by setting a value for the bytesPerSecond attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for bytesPerSecond
      Returns:
      A modified copy of the this object
    • withTimeRemaining

      public final BLProgressUpdate withTimeRemaining​(java.time.Duration value)
      Copy the current immutable object by setting a value for the timeRemaining attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for timeRemaining
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of BLProgressUpdate that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: name, fileIndexCurrent, fileIndexMaximum, attemptCurrent, attemptMaximum, bytesSent, bytesMaximum, progress, bytesPerSecond, timeRemaining.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value BLProgressUpdate with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • copyOf

      public static BLProgressUpdate copyOf​(BLProgressEventType.BLProgressUpdateType instance)
      Creates an immutable copy of a BLProgressEventType.BLProgressUpdateType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable BLProgressUpdate instance
    • builder

      public static BLProgressUpdate.Builder builder()
      Creates a builder for BLProgressUpdate.
       BLProgressUpdate.builder()
          .setName(String) // required name
          .setFileIndexCurrent(int) // required fileIndexCurrent
          .setFileIndexMaximum(int) // required fileIndexMaximum
          .setAttemptCurrent(int) // required attemptCurrent
          .setAttemptMaximum(int) // required attemptMaximum
          .setBytesSent(long) // required bytesSent
          .setBytesMaximum(long) // required bytesMaximum
          .setProgress(double) // required progress
          .setBytesPerSecond(long) // required bytesPerSecond
          .setTimeRemaining(java.time.Duration) // required timeRemaining
          .build();
       
      Returns:
      A new BLProgressUpdate builder