Class ImmutableProgram.Builder

java.lang.Object
net.bmahe.genetics4j.gpu.spec.ImmutableProgram.Builder
Enclosing class:
ImmutableProgram

public static final class ImmutableProgram.Builder extends Object
Builds instances of type ImmutableProgram. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Field Details

  • Constructor Details

    • Builder

      private Builder()
  • Method Details

    • from

      public final ImmutableProgram.Builder from(Program instance)
      Fill a builder with attribute values from the provided Program instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • addContent

      public final ImmutableProgram.Builder addContent(String element)
      Adds one element to content list.
      Parameters:
      element - A content element
      Returns:
      this builder for use in a chained invocation
    • addContent

      public final ImmutableProgram.Builder addContent(String... elements)
      Adds elements to content list.
      Parameters:
      elements - An array of content elements
      Returns:
      this builder for use in a chained invocation
    • content

      public final ImmutableProgram.Builder content(Iterable<String> elements)
      Sets or replaces all elements for content list.
      Parameters:
      elements - An iterable of content elements
      Returns:
      this builder for use in a chained invocation
    • addAllContent

      public final ImmutableProgram.Builder addAllContent(Iterable<String> elements)
      Adds elements to content list.
      Parameters:
      elements - An iterable of content elements
      Returns:
      this builder for use in a chained invocation
    • addResources

      public final ImmutableProgram.Builder addResources(String element)
      Adds one element to resources set.
      Parameters:
      element - A resources element
      Returns:
      this builder for use in a chained invocation
    • addResources

      public final ImmutableProgram.Builder addResources(String... elements)
      Adds elements to resources set.
      Parameters:
      elements - An array of resources elements
      Returns:
      this builder for use in a chained invocation
    • resources

      public final ImmutableProgram.Builder resources(Iterable<String> elements)
      Sets or replaces all elements for resources set.
      Parameters:
      elements - An iterable of resources elements
      Returns:
      this builder for use in a chained invocation
    • addAllResources

      public final ImmutableProgram.Builder addAllResources(Iterable<String> elements)
      Adds elements to resources set.
      Parameters:
      elements - An iterable of resources elements
      Returns:
      this builder for use in a chained invocation
    • addKernelNames

      public final ImmutableProgram.Builder addKernelNames(String element)
      Adds one element to kernelNames set.
      Parameters:
      element - A kernelNames element
      Returns:
      this builder for use in a chained invocation
    • addKernelNames

      public final ImmutableProgram.Builder addKernelNames(String... elements)
      Adds elements to kernelNames set.
      Parameters:
      elements - An array of kernelNames elements
      Returns:
      this builder for use in a chained invocation
    • kernelNames

      public final ImmutableProgram.Builder kernelNames(Iterable<String> elements)
      Sets or replaces all elements for kernelNames set.
      Parameters:
      elements - An iterable of kernelNames elements
      Returns:
      this builder for use in a chained invocation
    • addAllKernelNames

      public final ImmutableProgram.Builder addAllKernelNames(Iterable<String> elements)
      Adds elements to kernelNames set.
      Parameters:
      elements - An iterable of kernelNames elements
      Returns:
      this builder for use in a chained invocation
    • buildOptions

      public final ImmutableProgram.Builder buildOptions(String buildOptions)
      Initializes the optional value buildOptions to buildOptions.
      Parameters:
      buildOptions - The value for buildOptions
      Returns:
      this builder for chained invocation
    • buildOptions

      public final ImmutableProgram.Builder buildOptions(Optional<String> buildOptions)
      Initializes the optional value buildOptions to buildOptions.
      Parameters:
      buildOptions - The value for buildOptions
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableProgram build()
      Builds a new ImmutableProgram.
      Returns:
      An immutable instance of Program
      Throws:
      IllegalStateException - if any required attributes are missing