Record Class LatencyFigure

java.lang.Object
java.lang.Record
com.eqixiac.equinix.design.optimizer.context.LatencyFigure
Record Components:
roundTripMs - the round trip in ms, or null when unknown
basis - how the figure was obtained
note - detail for the reader (which pair was measured, the factor used); never null

public record LatencyFigure(Double roundTripMs, LatencyFigure.Basis basis, String note) extends Record
One round-trip latency with where it came from. Unknown is a first-class value: an LatencyFigure.Basis.UNKNOWN figure has no number at all.
  • Constructor Details

    • LatencyFigure

      public LatencyFigure(Double roundTripMs, LatencyFigure.Basis basis, String note)
      Rejects a number on an unknown figure and a missing number on a known one.
  • Method Details

    • unknown

      public static LatencyFigure unknown(String reason)
      Parameters:
      reason - why the latency is unknown
      Returns:
      an unknown figure
    • value

      public OptionalDouble value()
      Returns:
      the figure, or empty when unknown
    • isMeasured

      public boolean isMeasured()
      Returns:
      true for a Fabric measurement
    • render

      public String render()
      Returns:
      the figure as 12.3 ms (measured), or unknown
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • roundTripMs

      public Double roundTripMs()
      Returns the value of the roundTripMs record component.
      Returns:
      the value of the roundTripMs record component
    • basis

      public LatencyFigure.Basis basis()
      Returns the value of the basis record component.
      Returns:
      the value of the basis record component
    • note

      public String note()
      Returns the value of the note record component.
      Returns:
      the value of the note record component