Package org.djutils.base
Class MutableDouble
- java.lang.Object
-
- org.djutils.base.MutableDouble
-
public class MutableDouble extends Object
A simple version of a mutable double with get() and set(double) functions.Copyright (c) 2023-2023 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 Constructor Description MutableDouble(double value)Initialize the mutable double with a value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddec()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.booleanequals(Object obj)doubleget()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.StringtoString()
-
-
-
Method Detail
-
set
public void set(double newValue)
set the mutable double to a new value.- Parameters:
newValue- double; the new value of the mutable double
-
get
public double get()
- Returns:
- double; the current value of the mutable double
-
inc
public void inc(double increment)
Increment the modifiable double with a value.- Parameters:
increment- double; 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- double; 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- double; the value to multiply the modifiable double with
-
div
public void div(double divisor)
Divide the modifiable double by a value.- Parameters:
divisor- double; the value to divide the modifiable double by
-
-