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