Class 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
      void dec()
      Decrement the modifiable float with 1.
      void dec​(float decrement)
      Decrement the modifiable float with a value.
      void div​(float divisor)
      Divide the modifiable float by a value.
      boolean equals​(Object obj)
      float get()  
      int hashCode()
      void inc()
      Increment the modifiable float with 1.
      void inc​(float increment)
      Increment the modifiable float with a value.
      void mul​(float multiplier)
      Increment the modifiable float with a value.
      void set​(float newValue)
      set the mutable float to a new value.
      String toString()
    • Constructor Detail

      • MutableFloat

        public MutableFloat​(float value)
        Initialize the mutable float with a value.
        Parameters:
        value - float; the initial value of the mutable float
    • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object