Commit fb39375c authored by mey's avatar mey
Browse files

ConfigurableStorage.java: immediate return when passing 0 to add method

parent 65814756
......@@ -141,7 +141,13 @@ public class ConfigurableStorage<Q extends Quantity> extends BaseStorage<Q> impl
*/
@Override
public ChangeResult<Q> add(Amount<Q> amountToAdd) {
boolean positive = amountToAdd.getEstimatedValue() > 0;
double estimatedValue = amountToAdd.getEstimatedValue();
if (estimatedValue == 0) {
// nothing added
return new ChangeResult<>(AmountUtil.zero(amountToAdd), amountToAdd);
}
boolean positive = estimatedValue > 0;
Amount<Q> limit = positive ? getUpperLimit() : getLowerLimit();
int direction = positive ? DIRECTION_UPPER : DIRECTION_LOWER;
double factor = positive ? getFactorIn() : getFactorOut();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment