Package org.djutils.base
Class MutableFloat
- java.lang.Object
-
- org.djutils.base.MutableFloat
-
public class MutableFloat extends Object
A simple version of a mutable float with get() and set(float) 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 MutableFloat(float value)Initialize the mutable float with a value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddec()Decrement the modifiable float with 1.voiddec(float decrement)Decrement the modifiable float with a value.voiddiv(float divisor)Divide the modifiable float by a value.booleanequals(Object obj)floatget()inthashCode()voidinc()Increment the modifiable float with 1.voidinc(float increment)Increment the modifiable float with a value.voidmul(float multiplier)Increment the modifiable float with a value.voidset(float newValue)set the mutable float to a new value.StringtoString()
-
-
-
Method Detail
-
set
public void set(float newValue)
set the mutable float to a new value.- Parameters:
newValue- float; the new value of the mutable float
-
get
public float get()
- Returns:
- float; the current value of the mutable float
-
inc
public void inc(float increment)
Increment the modifiable float with a value.- Parameters:
increment- float; the value to increment the modifiable float with
-
inc
public void inc()
Increment the modifiable float with 1.
-
dec
public void dec(float decrement)
Decrement the modifiable float with a value.- Parameters:
decrement- float; the value to decrement the modifiable float with
-
dec
public void dec()
Decrement the modifiable float with 1.
-
mul
public void mul(float multiplier)
Increment the modifiable float with a value.- Parameters:
multiplier- float; the value to multiply the modifiable float with
-
div
public void div(float divisor)
Divide the modifiable float by a value.- Parameters:
divisor- float; the value to divide the modifiable float by
-
-