Package org.djutils.base
Class MutableDouble
java.lang.Object
org.djutils.base.MutableDouble
A simple version of a mutable double with get() and set(double) functions.
 
Copyright (c) 2023-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
 - Alexander Verbraeck
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoiddec()Decrement the modifiable double with 1.voiddec(double decrement) Decrement the modifiable double with a value.voiddiv(double divisor) Divide the modifiable double by a value.booleandoubleget()inthashCode()voidinc()Increment the modifiable double with 1.voidinc(double increment) Increment the modifiable double with a value.voidmul(double multiplier) Increment the modifiable double with a value.voidset(double newValue) set the mutable double to a new value.toString() 
- 
Constructor Details
- 
MutableDouble
public MutableDouble(double value) Initialize the mutable double with a value.- Parameters:
 value- the initial value of the mutable double
 
 - 
 - 
Method Details
- 
set
public void set(double newValue) set the mutable double to a new value.- Parameters:
 newValue- the new value of the mutable double
 - 
get
public double get()- Returns:
 - the current value of the mutable double
 
 - 
inc
public void inc(double increment) Increment the modifiable double with a value.- Parameters:
 increment- the value to increment the modifiable double with
 - 
inc
public void inc()Increment the modifiable double with 1. - 
dec
public void dec(double decrement) Decrement the modifiable double with a value.- Parameters:
 decrement- the value to decrement the modifiable double with
 - 
dec
public void dec()Decrement the modifiable double with 1. - 
mul
public void mul(double multiplier) Increment the modifiable double with a value.- Parameters:
 multiplier- the value to multiply the modifiable double with
 - 
div
public void div(double divisor) Divide the modifiable double by a value.- Parameters:
 divisor- the value to divide the modifiable double by
 - 
hashCode
public int hashCode() - 
equals
 - 
toString
 
 -