Package org.djutils.base
Class MutableFloat
java.lang.Object
org.djutils.base.MutableFloat
A simple version of a mutable float with get() and set(float) 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 float with 1.voiddec(float decrement) Decrement the modifiable float with a value.voiddiv(float divisor) Divide the modifiable float by a value.booleanfloatget()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.toString() 
- 
Constructor Details
- 
MutableFloat
public MutableFloat(float value) Initialize the mutable float with a value.- Parameters:
 value- the initial value of the mutable float
 
 - 
 - 
Method Details
- 
set
public void set(float newValue) set the mutable float to a new value.- Parameters:
 newValue- the new value of the mutable float
 - 
get
public float get()- Returns:
 - the current value of the mutable float
 
 - 
inc
public void inc(float increment) Increment the modifiable float with a value.- Parameters:
 increment- 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- 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- the value to multiply the modifiable float with
 - 
div
public void div(float divisor) Divide the modifiable float by a value.- Parameters:
 divisor- the value to divide the modifiable float by
 - 
hashCode
public int hashCode() - 
equals
 - 
toString
 
 -