Class ImmutableCLData

java.lang.Object
net.bmahe.genetics4j.gpu.spec.fitness.cldata.ImmutableCLData
All Implemented Interfaces:
CLData

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableCLData extends Object implements CLData
Immutable implementation of CLData.

Use the builder to create immutable instances: ImmutableCLData.builder(). Use the static factory method to create immutable instances: ImmutableCLData.of().

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Builds instances of type ImmutableCLData.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.jocl.cl_mem
     
    private final int
     
    private final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    ImmutableCLData(ImmutableCLData original, org.jocl.cl_mem clMem, int clType, int size)
     
    private
    ImmutableCLData(org.jocl.cl_mem clMem, int clType, int size)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a builder for ImmutableCLData.
    org.jocl.cl_mem
    Returns the OpenCL memory object that references the data stored on the device.
    int
    Returns the OpenCL data type of the elements stored in the memory buffer.
    copyOf(CLData instance)
    Creates an immutable copy of a CLData value.
    boolean
    equals(Object another)
    This instance is equal to all instances of ImmutableCLData that have equal attribute values.
    private boolean
    equalTo(int synthetic, ImmutableCLData another)
     
    int
    Computes a hash code from attributes: clMem, clType, size.
    of(org.jocl.cl_mem clMem, int clType, int size)
    Construct a new immutable CLData instance.
    int
    Returns the number of elements stored in the OpenCL memory buffer.
    Prints the immutable value CLData with attribute values.
    withClMem(org.jocl.cl_mem value)
    Copy the current immutable object by setting a value for the clMem attribute.
    withClType(int value)
    Copy the current immutable object by setting a value for the clType attribute.
    withSize(int value)
    Copy the current immutable object by setting a value for the size attribute.

    Methods inherited from class java.lang.Object

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

    • clMem

      private final org.jocl.cl_mem clMem
    • clType

      private final int clType
    • size

      private final int size
  • Constructor Details

    • ImmutableCLData

      private ImmutableCLData(org.jocl.cl_mem clMem, int clType, int size)
    • ImmutableCLData

      private ImmutableCLData(ImmutableCLData original, org.jocl.cl_mem clMem, int clType, int size)
  • Method Details

    • clMem

      public org.jocl.cl_mem clMem()
      Returns the OpenCL memory object that references the data stored on the device.
      Specified by:
      clMem in interface CLData
      Returns:
      the OpenCL memory object (cl_mem) containing the device data
    • clType

      public int clType()
      Returns the OpenCL data type of the elements stored in the memory buffer.

      Common OpenCL types include CL_FLOAT, CL_DOUBLE, CL_INT, and CL_CHAR. This information is used for proper kernel parameter binding and type checking.

      Specified by:
      clType in interface CLData
      Returns:
      the OpenCL data type constant (e.g., CL_FLOAT, CL_DOUBLE)
    • size

      public int size()
      Returns the number of elements stored in the OpenCL memory buffer.

      This represents the count of individual data elements (not bytes) contained in the memory object. For example, a buffer containing 1000 floating-point values would have a size of 1000, regardless of the actual byte size.

      Specified by:
      size in interface CLData
      Returns:
      the number of elements in the memory buffer
    • withClMem

      public final ImmutableCLData withClMem(org.jocl.cl_mem value)
      Copy the current immutable object by setting a value for the clMem attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for clMem
      Returns:
      A modified copy of the this object
    • withClType

      public final ImmutableCLData withClType(int value)
      Copy the current immutable object by setting a value for the clType attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for clType
      Returns:
      A modified copy of the this object
    • withSize

      public final ImmutableCLData withSize(int 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 of the this object
    • equals

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

      private boolean equalTo(int synthetic, ImmutableCLData another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: clMem, clType, size.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableCLData of(org.jocl.cl_mem clMem, int clType, int size)
      Construct a new immutable CLData instance.
      Parameters:
      clMem - The value for the clMem attribute
      clType - The value for the clType attribute
      size - The value for the size attribute
      Returns:
      An immutable CLData instance
    • copyOf

      public static ImmutableCLData copyOf(CLData instance)
      Creates an immutable copy of a CLData 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 CLData instance
    • builder

      public static ImmutableCLData.Builder builder()
      Creates a builder for ImmutableCLData.
       ImmutableCLData.builder()
          .clMem(org.jocl.cl_mem) // required clMem
          .clType(int) // required clType
          .size(int) // required size
          .build();
       
      Returns:
      A new ImmutableCLData builder