Class MutableShort

java.lang.Object
org.djutils.base.MutableShort

public class MutableShort extends Object
A simple version of a mutable short with get() and set(short) 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 Summary

    Constructors
    Constructor
    Description
    MutableShort(short value)
    Initialize the mutable short with a value.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    dec()
    Decrement the modifiable short with 1.
    void
    dec(short decrement)
    Decrement the modifiable short with a value.
    void
    div(short divisor)
    Divide the modifiable short by a value.
    boolean
     
    short
    get()
     
    int
     
    void
    inc()
    Increment the modifiable short with 1.
    void
    inc(short increment)
    Increment the modifiable short with a value.
    void
    mul(short multiplier)
    Increment the modifiable short with a value.
    void
    set(short newValue)
    set the mutable short to a new value.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MutableShort

      public MutableShort(short value)
      Initialize the mutable short with a value.
      Parameters:
      value - short; 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 - short; the new value of the mutable short
    • get

      public short get()
      Returns:
      short; the current value of the mutable short
    • inc

      public void inc(short increment)
      Increment the modifiable short with a value.
      Parameters:
      increment - short; 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 - short; 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 - short; the value to multiply the modifiable short with
    • div

      public void div(short divisor)
      Divide the modifiable short by a value.
      Parameters:
      divisor - short; the value to divide the modifiable short by
    • 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