Class BandwidthTier
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.
| Case | BandwidthTier | ServiceProfileOption |
|---|---|---|
requested <= 0 | OptionalInt.empty() | -1 |
| requested equals a tier | that tier | that tier |
| requested between two tiers | the higher tier | the higher tier |
| requested above the largest tier | OptionalInt.empty() | -1 |
| empty tier list | OptionalInt.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 Summary
Modifier and TypeMethodDescriptionbooleancanCover(int requestedMbps) booleancontains(int mbps) Exact-tier test, with no rounding.coveringTier(int requestedMbps) The smallest published tier that is not below the requested size.booleaninthashCode()booleanisEmpty()static BandwidthTiernone()static BandwidthTierof(int... tiersMbps) Creates a tier set from sizes in Mbps.static BandwidthTierof(Collection<Integer> tiersMbps) Creates a tier set from a collection of sizes in Mbps.toList()The JSON form: the ascending tier list, matching the shape of the specification'ssupportedConnectionSizeMbpsarray.toString()
-
Method Details
-
none
- Returns:
- the empty tier set;
coveringTier(int)on it is always empty
-
of
Creates a tier set from a collection of sizes in Mbps.- Parameters:
tiersMbps- the sizes in Mbps, in any order;nullis treated as empty;nullelements, elements<= 0and duplicates are dropped- Returns:
- the tier set
-
of
Creates a tier set from sizes in Mbps.- Parameters:
tiersMbps- the sizes in Mbps, in any order;nullis treated as empty; elements<= 0and duplicates are dropped- Returns:
- the tier set
-
tiersMbps
-
toList
-
coveringTier
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 whenrequestedMbps <= 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:
truewhencoveringTier(int)is present forrequestedMbps
-
contains
public boolean contains(int mbps) Exact-tier test, with no rounding.- Parameters:
mbps- a connection size in Mbps- Returns:
truewhenmbpsis one of the published tiers
-
smallestMbps
- Returns:
- the smallest published tier in Mbps, or empty when no tier is published
-
largestMbps
- Returns:
- the largest published tier in Mbps, or empty when no tier is published
-
isEmpty
public boolean isEmpty()- Returns:
truewhen no tier is published
-
equals
-
hashCode
-
toString
-