Class ImmutableProgram

java.lang.Object
net.bmahe.genetics4j.gpu.spec.Program
net.bmahe.genetics4j.gpu.spec.ImmutableProgram

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableProgram extends Program
Immutable implementation of Program.

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

  • Field Details

    • content

      private final List<String> content
    • resources

      private final Set<String> resources
    • kernelNames

      private final Set<String> kernelNames
    • buildOptions

      private final String buildOptions
  • Constructor Details

  • Method Details

    • content

      public List<String> content()
      Specified by:
      content in class Program
      Returns:
      The value of the content attribute
    • resources

      public Set<String> resources()
      Specified by:
      resources in class Program
      Returns:
      The value of the resources attribute
    • kernelNames

      public Set<String> kernelNames()
      Specified by:
      kernelNames in class Program
      Returns:
      The value of the kernelNames attribute
    • buildOptions

      public Optional<String> buildOptions()
      Specified by:
      buildOptions in class Program
      Returns:
      The value of the buildOptions attribute
    • withContent

      public final ImmutableProgram withContent(String... elements)
      Copy the current immutable object with elements that replace the content of content.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withContent

      public final ImmutableProgram withContent(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of content. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of content elements to set
      Returns:
      A modified copy of this object
    • withResources

      public final ImmutableProgram withResources(String... elements)
      Copy the current immutable object with elements that replace the content of resources.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withResources

      public final ImmutableProgram withResources(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of resources. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of resources elements to set
      Returns:
      A modified copy of this object
    • withKernelNames

      public final ImmutableProgram withKernelNames(String... elements)
      Copy the current immutable object with elements that replace the content of kernelNames.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withKernelNames

      public final ImmutableProgram withKernelNames(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of kernelNames. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of kernelNames elements to set
      Returns:
      A modified copy of this object
    • withBuildOptions

      public final ImmutableProgram withBuildOptions(String value)
      Copy the current immutable object by setting a present value for the optional buildOptions attribute.
      Parameters:
      value - The value for buildOptions
      Returns:
      A modified copy of this object
    • withBuildOptions

      public final ImmutableProgram withBuildOptions(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the buildOptions attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for buildOptions
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableProgram 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, ImmutableProgram another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: content, resources, kernelNames, buildOptions.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableProgram of(List<String> content, Set<String> resources, Set<String> kernelNames)
      Construct a new immutable Program instance.
      Parameters:
      content - The value for the content attribute
      resources - The value for the resources attribute
      kernelNames - The value for the kernelNames attribute
      Returns:
      An immutable Program instance
    • of

      public static ImmutableProgram of(Iterable<String> content, Iterable<String> resources, Iterable<String> kernelNames)
      Construct a new immutable Program instance.
      Parameters:
      content - The value for the content attribute
      resources - The value for the resources attribute
      kernelNames - The value for the kernelNames attribute
      Returns:
      An immutable Program instance
    • validate

      private static ImmutableProgram validate(ImmutableProgram instance)
    • copyOf

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

      public static ImmutableProgram.Builder builder()
      Creates a builder for ImmutableProgram.
       ImmutableProgram.builder()
          .addContent|addAllContent(String) // content elements
          .addResources|addAllResources(String) // resources elements
          .addKernelNames|addAllKernelNames(String) // kernelNames elements
          .buildOptions(String) // optional buildOptions
          .build();
       
      Returns:
      A new ImmutableProgram builder
    • createSafeList

      private static <T> List<T> createSafeList(Iterable<? extends T> iterable, boolean checkNulls, boolean skipNulls)
    • createUnmodifiableList

      private static <T> List<T> createUnmodifiableList(boolean clone, List<T> list)
    • createUnmodifiableSet

      private static <T> Set<T> createUnmodifiableSet(List<T> list)
      Unmodifiable set constructed from list to avoid rehashing.