Class PriceBands
java.lang.Object
com.eqixiac.equinix.design.cost.PriceBands
The plausible range of a price, derived only from where it came from. A live or caller-supplied
figure is exact; anything indicative carries a stated band around its expected value.
PriceSource.EQUINIX_LIVE,PriceSource.CUSTOM,PriceSource.PROVIDER_API: exact.PriceSource.REFERENCEandPriceSource.COMPOSITE: ±25%.PriceSource.ESTIMATE: ±50%.
A line restated in another currency is widened further by its rate's band (fxLow(BigDecimal, BigDecimal, double),
fxHigh(BigDecimal, BigDecimal, double)): 0 for a rate pinned in the spec (unless the spec states one),
±2.0% for a live ECB reference
rate, ±5.0% for the bundled table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHalf-width of the band around a derived estimate, in percent.static final intHalf-width of the band around a reference (dated, indicative) figure, in percent. -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdescribe(PriceSource source) static BigDecimalfxHigh(BigDecimal high, BigDecimal rate, double bandPercent) The high end of a converted line:high x rate x (1 + bandPercent/100), rounded half-up.static BigDecimalfxLow(BigDecimal low, BigDecimal rate, double bandPercent) The low end of a line restated at an exchange rate, widened by the FX allowance:low x rate x (1 - bandPercent/100), rounded half-up to cents.static doublehalfWidth(PriceSource source) static BigDecimalhigh(BigDecimal expected, PriceSource source) static BigDecimallow(BigDecimal expected, PriceSource source)
-
Field Details
-
REFERENCE_BAND_PERCENT
public static final int REFERENCE_BAND_PERCENTHalf-width of the band around a reference (dated, indicative) figure, in percent.- See Also:
-
ESTIMATE_BAND_PERCENT
public static final int ESTIMATE_BAND_PERCENTHalf-width of the band around a derived estimate, in percent.- See Also:
-
-
Method Details
-
halfWidth
- Parameters:
source- where the price came from- Returns:
- the band half-width as a fraction (0 for an exact source)
-
low
- Parameters:
expected- the expected amountsource- where it came from- Returns:
- the low end of its range
-
high
- Parameters:
expected- the expected amountsource- where it came from- Returns:
- the high end of its range
-
fxLow
The low end of a line restated at an exchange rate, widened by the FX allowance:low x rate x (1 - bandPercent/100), rounded half-up to cents.- Parameters:
low- the line's low end in its own currencyrate- units of the target currency per unit of the line's currencybandPercent- the FX allowance either side, in percent- Returns:
- the converted, widened low end
-
fxHigh
The high end of a converted line:high x rate x (1 + bandPercent/100), rounded half-up.- Parameters:
high- the line's high end in its own currencyrate- units of the target currency per unit of the line's currencybandPercent- the FX allowance either side, in percent- Returns:
- the converted, widened high end
-
describe
- Parameters:
source- where a price came from- Returns:
- a short statement of the band, for line notes
-