Class MutableBoolean

java.lang.Object
org.djutils.base.MutableBoolean

public class MutableBoolean extends Object
A simple version of a mutable boolean with get() and set(boolean) functions.

Copyright (c) 2023-2024 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 Details

    • MutableBoolean

      public MutableBoolean(boolean value)
      Initialize the mutable boolean with a value.
      Parameters:
      value - boolean; the initial value of the mutable boolean
  • Method Details

    • set

      public void set(boolean newValue)
      set the mutable boolean to a new value.
      Parameters:
      newValue - boolean; the new value of the mutable boolean
    • get

      public boolean get()
      Returns:
      boolean; the current value of the mutable boolean
    • flip

      public void flip()
      Flip the value of modifiable boolean.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object