/** * Obtains an instance that replaces the base value. * <p> * The base value is ignored when calculating the result. * * @param replacementValue the replacement value to use as the result of the adjustment * @return the adjustment, capturing the replacement value */ public static ValueAdjustment ofReplace(double replacementValue) { return new ValueAdjustment(replacementValue, ValueAdjustmentType.REPLACE); }
/** * Obtains an instance specifying an amount to add to the base value. * <p> * The result will be {@code (baseValue + deltaAmount)}. * * @param deltaAmount the amount to be added to the base value * @return the adjustment, capturing the delta amount */ public static ValueAdjustment ofDeltaAmount(double deltaAmount) { return new ValueAdjustment(deltaAmount, ValueAdjustmentType.DELTA_AMOUNT); }
/** * Obtains an instance specifying a multiplication factor, adding it to the base value. * <p> * The result will be {@code (baseValue + baseValue * modifyingValue)}. * * @param deltaMultiplier the multiplication factor to apply to the base amount * with the result added to the base amount * @return the adjustment, capturing the delta multiplier */ public static ValueAdjustment ofDeltaMultiplier(double deltaMultiplier) { return new ValueAdjustment(deltaMultiplier, ValueAdjustmentType.DELTA_MULTIPLIER); }
/** * Obtains an instance specifying a multiplication factor to apply to the base value. * <p> * The result will be {@code (baseValue * modifyingValue)}. * * @param multiplier the multiplication factor to apply to the base amount * @return the adjustment */ public static ValueAdjustment ofMultiplier(double multiplier) { return new ValueAdjustment(multiplier, ValueAdjustmentType.MULTIPLIER); }
@Override public ValueAdjustment build() { return new ValueAdjustment( modifyingValue, type); }