Class BandwidthTier

java.lang.Object
com.eqixiac.equinix.core.model.multicloud.BandwidthTier

public final class BandwidthTier extends Object
An immutable, ascending set of discrete connection sizes in Mbps, as published by the specification's Environment.supportedConnectionSizeMbps (and by the Fabric v4 Beta ProviderEnvironment.supportedBandwidths).

Beta: derived from the open specification at commit bbfc763 (see the package documentation).

Construction

of(Collection) and of(int...) drop null entries, drop entries <= 0 and collapse duplicates. The specification's schema examples contain 0 placeholders; a size of zero is not a connection size. All units are Mbps.

Round-up rule

coveringTier(int) returns the smallest tier that is not below the requested size. For a non-empty discrete tier list this is the same rule as design.optimizer.model.ServiceProfileOption.coveringTier(int) with no per-metro ceiling and custom bandwidth disallowed; a parity test locks the two implementations together.

Behavior compared with ServiceProfileOption.coveringTier(int)
CaseBandwidthTierServiceProfileOption
requested <= 0OptionalInt.empty()-1
requested equals a tierthat tierthat tier
requested between two tiersthe higher tierthe higher tier
requested above the largest tierOptionalInt.empty()-1
empty tier listOptionalInt.empty() the requested size (a Fabric profile without a tier list accepts any size)

The last row is a deliberate difference. The specification has no custom-bandwidth flag: an environment that publishes no sizes offers no size this type can confirm, so nothing is reported as covered.

Author:
ianjones
  • Method Details

    • none

      public static BandwidthTier none()
      Returns:
      the empty tier set; coveringTier(int) on it is always empty
    • of

      public static BandwidthTier of(Collection<Integer> tiersMbps)
      Creates a tier set from a collection of sizes in Mbps.
      Parameters:
      tiersMbps - the sizes in Mbps, in any order; null is treated as empty; null elements, elements <= 0 and duplicates are dropped
      Returns:
      the tier set
    • of

      public static BandwidthTier of(int... tiersMbps)
      Creates a tier set from sizes in Mbps.
      Parameters:
      tiersMbps - the sizes in Mbps, in any order; null is treated as empty; elements <= 0 and duplicates are dropped
      Returns:
      the tier set
    • tiersMbps

      public SortedSet<Integer> tiersMbps()
      Returns:
      the tiers in Mbps, ascending, unmodifiable; empty when no tier is published
    • toList

      public List<Integer> toList()
      The JSON form: the ascending tier list, matching the shape of the specification's supportedConnectionSizeMbps array.
      Returns:
      the tiers in Mbps as an ascending, unmodifiable list
    • coveringTier

      public OptionalInt coveringTier(int requestedMbps)
      The smallest published tier that is not below the requested size.
      Parameters:
      requestedMbps - the requested connection size in Mbps
      Returns:
      the smallest tier >= requestedMbps; empty when requestedMbps <= 0, when it exceeds every tier, or when no tier is published
    • canCover

      public boolean canCover(int requestedMbps)
      Parameters:
      requestedMbps - the requested connection size in Mbps
      Returns:
      true when coveringTier(int) is present for requestedMbps
    • contains

      public boolean contains(int mbps)
      Exact-tier test, with no rounding.
      Parameters:
      mbps - a connection size in Mbps
      Returns:
      true when mbps is one of the published tiers
    • smallestMbps

      public OptionalInt smallestMbps()
      Returns:
      the smallest published tier in Mbps, or empty when no tier is published
    • largestMbps

      public OptionalInt largestMbps()
      Returns:
      the largest published tier in Mbps, or empty when no tier is published
    • isEmpty

      public boolean isEmpty()
      Returns:
      true when no tier is published
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the ascending tier list with its unit, for example [1000, 10000] Mbps