/** * Adjusts the base value based on the criteria of this adjustment. * <p> * For example, if this adjustment represents a 10% decrease, then the * result will be the base value minus 10%. * * @param baseValue the base, or previous, value to be adjusted * @return the calculated result */ public double adjust(double baseValue) { return type.adjust(baseValue, modifyingValue); }
public void test_adjust() { assertEquals(ValueAdjustmentType.DELTA_AMOUNT.adjust(2d, 3d), 5d, 1e-12); assertEquals(ValueAdjustmentType.DELTA_MULTIPLIER.adjust(2d, 1.5d), 5d, 1e-12); assertEquals(ValueAdjustmentType.MULTIPLIER.adjust(2d, 1.5d), 3d, 1e-12); assertEquals(ValueAdjustmentType.REPLACE.adjust(2d, 1.5d), 1.5d, 1e-12); }