Class MutableByte

java.lang.Object
org.djutils.base.MutableByte

public class MutableByte extends Object
A simple version of a mutable byte with get() and set(byte) 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
    MutableByte(byte value)
    Initialize the mutable byte with a value.
  • Method Summary

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

    Methods inherited from class java.lang.Object

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

    • MutableByte

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

    • set

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

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

      public void inc(byte increment)
      Increment the modifiable byte with a value.
      Parameters:
      increment - byte; the value to increment the modifiable byte with
    • inc

      public void inc()
      Increment the modifiable byte with 1.
    • dec

      public void dec(byte decrement)
      Decrement the modifiable byte with a value.
      Parameters:
      decrement - byte; the value to decrement the modifiable byte with
    • dec

      public void dec()
      Decrement the modifiable byte with 1.
    • mul

      public void mul(byte multiplier)
      Increment the modifiable byte with a value.
      Parameters:
      multiplier - byte; the value to multiply the modifiable byte with
    • div

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