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