Class LatencyMatrix

java.lang.Object
com.eqixiac.equinix.design.optimizer.model.LatencyMatrix

public class LatencyMatrix extends Object
A metro-by-site latency grid. Provides indexed access and formatted output for architecture review documents.

A matrix built for a request with no user sites has a row per metro but no columns: there is nothing to measure latency to. The OptionalDouble-returning accessors (worstCaseMs, averageMs) report that as an absent value rather than as a number, so callers cannot mistake "not measurable" for a measurement.

  • Constructor Details

    • LatencyMatrix

      public LatencyMatrix()
  • Method Details

    • get

      public Optional<LatencyEntry> get(MetroId metro, String siteLabel)
      Retrieves the latency entry for a specific metro-site pair.
    • hasSites

      public boolean hasSites()
      Returns true when this matrix has at least one site column, i.e. when its latency figures are measurable at all. When this is false, worstCaseMs and averageMs are empty for every metro and toTableString() renders the empty placeholder.
    • worstCaseMs

      public OptionalDouble worstCaseMs(MetroId metro)
      Worst-case latency in milliseconds from a metro to any site.
      Parameters:
      metro - the metro to measure from
      Returns:
      the highest latency to any site, or OptionalDouble.empty() when the metro is not in this matrix or the request defined no sites
    • averageMs

      public OptionalDouble averageMs(MetroId metro)
      Average latency in milliseconds from a metro to all sites.
      Parameters:
      metro - the metro to measure from
      Returns:
      the mean latency across all sites, or OptionalDouble.empty() when the metro is not in this matrix or the request defined no sites
    • toTableString

      public String toTableString()
      Renders the latency matrix as an ASCII table suitable for console output or inclusion in markdown reports.