# Class VMAAllocationInfo

java.lang.Object
com.io7m.jcoronado.vma.VMAAllocationInfo

All Implemented Interfaces:
  `VMAAllocationInfoType`

public final class VMAAllocationInfo extends Object implements VMAAllocationInfoType
Information about an allocation. This is an immutable snapshot of an allocation.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `VMAAllocationInfo.Builder`
  Builds instances of type `VMAAllocationInfo`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static VMAAllocationInfo.Builder`
  `builder()`
  Creates a builder for `VMAAllocationInfo`.
  `static VMAAllocationInfo`
  `copyOf(VMAAllocationInfoType instance)`
  Creates an immutable copy of a `VMAAllocationInfoType` value.
  `Optional<VulkanDeviceMemoryType>`
  `deviceMemory()`
  `boolean`
  `equals(Object another)`
  This instance is equal to all instances of `VMAAllocationInfo` that have equal attribute values.
  `int`
  `hashCode()`
  Computes a hash code from attributes: `memoryType`, `deviceMemory`, `offset`, `size`.
  `long`
  `memoryType()`
  `long`
  `offset()`
  `long`
  `size()`
  `String`
  `toString()`
  Prints the immutable value `VMAAllocationInfo` with attribute values.
  `final VMAAllocationInfo`
  `withDeviceMemory(VulkanDeviceMemoryType value)`
  Copy the current immutable object by setting a present value for the optional `deviceMemory` attribute.
  `final VMAAllocationInfo`
  `withDeviceMemory(Optional<? extends VulkanDeviceMemoryType> optional)`
  Copy the current immutable object by setting an optional value for the `deviceMemory` attribute.
  `final VMAAllocationInfo`
  `withMemoryType(long value)`
  Copy the current immutable object by setting a value for the `memoryType` attribute.
  `final VMAAllocationInfo`
  `withOffset(long value)`
  Copy the current immutable object by setting a value for the `offset` attribute.
  `final VMAAllocationInfo`
  `withSize(long value)`
  Copy the current immutable object by setting a value for the `size` attribute.

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### memoryType

    public long memoryType()
    Specified by:
      `memoryType` in interface `VMAAllocationInfoType`
    Returns:
      The memory type index that this allocation was allocated from.

  - ### deviceMemory

    public Optional<VulkanDeviceMemoryType> deviceMemory()
    Specified by:
      `deviceMemory` in interface `VMAAllocationInfoType`
    Returns:
      A handle to the Vulkan memory object. Same memory object can be shared by multiple allocations. It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost. If the allocation is lost, it is equal to `VK_NULL_HANDLE`.

  - ### offset

    public long offset()
    Specified by:
      `offset` in interface `VMAAllocationInfoType`
    Returns:
      The offset into the device memory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation. It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.

  - ### size

    public long size()
    Specified by:
      `size` in interface `VMAAllocationInfoType`
    Returns:
      The size of this allocation, in bytes. It never changes, unless allocation is lost.

  - ### withMemoryType

    public final VMAAllocationInfo withMemoryType(long value)
    Copy the current immutable object by setting a value for the `memoryType` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for memoryType
    Returns:
      A modified copy or the `this` object

  - ### withDeviceMemory

    public final VMAAllocationInfo withDeviceMemory(VulkanDeviceMemoryType value)
    Copy the current immutable object by setting a present value for the optional `deviceMemory` attribute.
    Parameters:
      `value` - The value for deviceMemory
    Returns:
      A modified copy or `this` if not changed

  - ### withDeviceMemory

    public final VMAAllocationInfo withDeviceMemory(Optional<? extends VulkanDeviceMemoryType> optional)
    Copy the current immutable object by setting an optional value for the `deviceMemory` attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning `this`.
    Parameters:
      `optional` - An optional value for deviceMemory
    Returns:
      A modified copy or `this` if not changed

  - ### withOffset

    public final VMAAllocationInfo withOffset(long value)
    Copy the current immutable object by setting a value for the `offset` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for offset
    Returns:
      A modified copy or the `this` object

  - ### withSize

    public final VMAAllocationInfo withSize(long value)
    Copy the current immutable object by setting a value for the `size` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for size
    Returns:
      A modified copy or the `this` object

  - ### equals

    public boolean equals(Object another)
    This instance is equal to all instances of `VMAAllocationInfo` that have equal attribute values.
    Overrides:
      `equals` in class `Object`
    Returns:
      `true` if `this` is equal to `another` instance

  - ### hashCode

    public int hashCode()
    Computes a hash code from attributes: `memoryType`, `deviceMemory`, `offset`, `size`.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      hashCode value

  - ### toString

    public String toString()
    Prints the immutable value `VMAAllocationInfo` with attribute values.
    Overrides:
      `toString` in class `Object`
    Returns:
      A string representation of the value

  - ### copyOf

    public static VMAAllocationInfo copyOf(VMAAllocationInfoType instance)
    Creates an immutable copy of a `VMAAllocationInfoType` value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
    Parameters:
      `instance` - The instance to copy
    Returns:
      A copied immutable VMAAllocationInfo instance

  - ### builder

    public static VMAAllocationInfo.Builder builder()
    Creates a builder for `VMAAllocationInfo`.

        VMAAllocationInfo.builder()
           .setMemoryType(long) // optional memoryType
           .setDeviceMemory(Optional<com.io7m.jcoronado.api.VulkanDeviceMemoryType>) // optional deviceMemory
           .setOffset(long) // optional offset
           .setSize(long) // optional size
           .build();

    Returns:
      A new VMAAllocationInfo builder