Class ImmutableStageDescriptor.Builder

java.lang.Object
net.bmahe.genetics4j.gpu.spec.fitness.multistage.ImmutableStageDescriptor.Builder
Direct Known Subclasses:
StageDescriptor.Builder
Enclosing class:
ImmutableStageDescriptor

public static class ImmutableStageDescriptor.Builder extends Object
Builds instances of type ImmutableStageDescriptor. 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

      public Builder()
      Creates a builder for ImmutableStageDescriptor instances.
       new StageDescriptor.Builder()
          .kernelName(String) // required kernelName
          .kernelExecutionContextComputer(net.bmahe.genetics4j.gpu.spec.fitness.kernelcontext.KernelExecutionContextComputer) // required kernelExecutionContextComputer
          .putDataLoaders|putAllDataLoaders(int => net.bmahe.genetics4j.gpu.spec.fitness.cldata.DataLoader) // dataLoaders mappings
          .putLocalMemoryAllocators|putAllLocalMemoryAllocators(int => net.bmahe.genetics4j.gpu.spec.fitness.cldata.LocalMemoryAllocator) // localMemoryAllocators mappings
          .putResultAllocators|putAllResultAllocators(int => net.bmahe.genetics4j.gpu.spec.fitness.cldata.ResultAllocator) // resultAllocators mappings
          .putReusePreviousResultAsArguments|putAllReusePreviousResultAsArguments(int => int) // reusePreviousResultAsArguments mappings
          .putReusePreviousResultSizeAsArguments|putAllReusePreviousResultSizeAsArguments(int => int) // reusePreviousResultSizeAsArguments mappings
          .putMapStaticDataAsArgument|putAllMapStaticDataAsArgument(String => int) // mapStaticDataAsArgument mappings
          .build();
       
  • Method Details

    • from

      public final StageDescriptor.Builder from(StageDescriptor instance)
      Fill a builder with attribute values from the provided StageDescriptor 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
    • kernelName

      public final StageDescriptor.Builder kernelName(String kernelName)
      Initializes the value for the kernelName attribute.
      Parameters:
      kernelName - The value for kernelName
      Returns:
      this builder for use in a chained invocation
    • kernelExecutionContextComputer

      public final StageDescriptor.Builder kernelExecutionContextComputer(KernelExecutionContextComputer kernelExecutionContextComputer)
      Initializes the value for the kernelExecutionContextComputer attribute.
      Parameters:
      kernelExecutionContextComputer - The value for kernelExecutionContextComputer
      Returns:
      this builder for use in a chained invocation
    • putDataLoaders

      public final StageDescriptor.Builder putDataLoaders(int key, DataLoader value)
      Put one entry to the dataLoaders map.
      Parameters:
      key - The key in the dataLoaders map
      value - The associated value in the dataLoaders map
      Returns:
      this builder for use in a chained invocation
    • putDataLoaders

      public final StageDescriptor.Builder putDataLoaders(Map.Entry<Integer,? extends DataLoader> entry)
      Put one entry to the dataLoaders map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • dataLoaders

      public final StageDescriptor.Builder dataLoaders(Map<Integer,? extends DataLoader> entries)
      Sets or replaces all mappings from the specified map as entries for the dataLoaders map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the dataLoaders map
      Returns:
      this builder for use in a chained invocation
    • putAllDataLoaders

      public final StageDescriptor.Builder putAllDataLoaders(Map<Integer,? extends DataLoader> entries)
      Put all mappings from the specified map as entries to dataLoaders map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the dataLoaders map
      Returns:
      this builder for use in a chained invocation
    • putLocalMemoryAllocators

      public final StageDescriptor.Builder putLocalMemoryAllocators(int key, LocalMemoryAllocator value)
      Put one entry to the localMemoryAllocators map.
      Parameters:
      key - The key in the localMemoryAllocators map
      value - The associated value in the localMemoryAllocators map
      Returns:
      this builder for use in a chained invocation
    • putLocalMemoryAllocators

      public final StageDescriptor.Builder putLocalMemoryAllocators(Map.Entry<Integer,? extends LocalMemoryAllocator> entry)
      Put one entry to the localMemoryAllocators map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • localMemoryAllocators

      public final StageDescriptor.Builder localMemoryAllocators(Map<Integer,? extends LocalMemoryAllocator> entries)
      Sets or replaces all mappings from the specified map as entries for the localMemoryAllocators map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the localMemoryAllocators map
      Returns:
      this builder for use in a chained invocation
    • putAllLocalMemoryAllocators

      public final StageDescriptor.Builder putAllLocalMemoryAllocators(Map<Integer,? extends LocalMemoryAllocator> entries)
      Put all mappings from the specified map as entries to localMemoryAllocators map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the localMemoryAllocators map
      Returns:
      this builder for use in a chained invocation
    • putResultAllocators

      public final StageDescriptor.Builder putResultAllocators(int key, ResultAllocator value)
      Put one entry to the resultAllocators map.
      Parameters:
      key - The key in the resultAllocators map
      value - The associated value in the resultAllocators map
      Returns:
      this builder for use in a chained invocation
    • putResultAllocators

      public final StageDescriptor.Builder putResultAllocators(Map.Entry<Integer,? extends ResultAllocator> entry)
      Put one entry to the resultAllocators map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • resultAllocators

      public final StageDescriptor.Builder resultAllocators(Map<Integer,? extends ResultAllocator> entries)
      Sets or replaces all mappings from the specified map as entries for the resultAllocators map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the resultAllocators map
      Returns:
      this builder for use in a chained invocation
    • putAllResultAllocators

      public final StageDescriptor.Builder putAllResultAllocators(Map<Integer,? extends ResultAllocator> entries)
      Put all mappings from the specified map as entries to resultAllocators map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the resultAllocators map
      Returns:
      this builder for use in a chained invocation
    • putReusePreviousResultAsArguments

      public final StageDescriptor.Builder putReusePreviousResultAsArguments(int key, int value)
      Put one entry to the reusePreviousResultAsArguments map.
      Parameters:
      key - The key in the reusePreviousResultAsArguments map
      value - The associated value in the reusePreviousResultAsArguments map
      Returns:
      this builder for use in a chained invocation
    • putReusePreviousResultAsArguments

      public final StageDescriptor.Builder putReusePreviousResultAsArguments(Map.Entry<Integer,? extends Integer> entry)
      Put one entry to the reusePreviousResultAsArguments map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • reusePreviousResultAsArguments

      public final StageDescriptor.Builder reusePreviousResultAsArguments(Map<Integer,? extends Integer> entries)
      Sets or replaces all mappings from the specified map as entries for the reusePreviousResultAsArguments map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the reusePreviousResultAsArguments map
      Returns:
      this builder for use in a chained invocation
    • putAllReusePreviousResultAsArguments

      public final StageDescriptor.Builder putAllReusePreviousResultAsArguments(Map<Integer,? extends Integer> entries)
      Put all mappings from the specified map as entries to reusePreviousResultAsArguments map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the reusePreviousResultAsArguments map
      Returns:
      this builder for use in a chained invocation
    • putReusePreviousResultSizeAsArguments

      public final StageDescriptor.Builder putReusePreviousResultSizeAsArguments(int key, int value)
      Put one entry to the reusePreviousResultSizeAsArguments map.
      Parameters:
      key - The key in the reusePreviousResultSizeAsArguments map
      value - The associated value in the reusePreviousResultSizeAsArguments map
      Returns:
      this builder for use in a chained invocation
    • putReusePreviousResultSizeAsArguments

      public final StageDescriptor.Builder putReusePreviousResultSizeAsArguments(Map.Entry<Integer,? extends Integer> entry)
      Put one entry to the reusePreviousResultSizeAsArguments map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • reusePreviousResultSizeAsArguments

      public final StageDescriptor.Builder reusePreviousResultSizeAsArguments(Map<Integer,? extends Integer> entries)
      Sets or replaces all mappings from the specified map as entries for the reusePreviousResultSizeAsArguments map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the reusePreviousResultSizeAsArguments map
      Returns:
      this builder for use in a chained invocation
    • putAllReusePreviousResultSizeAsArguments

      public final StageDescriptor.Builder putAllReusePreviousResultSizeAsArguments(Map<Integer,? extends Integer> entries)
      Put all mappings from the specified map as entries to reusePreviousResultSizeAsArguments map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the reusePreviousResultSizeAsArguments map
      Returns:
      this builder for use in a chained invocation
    • putMapStaticDataAsArgument

      public final StageDescriptor.Builder putMapStaticDataAsArgument(String key, int value)
      Put one entry to the mapStaticDataAsArgument map.
      Parameters:
      key - The key in the mapStaticDataAsArgument map
      value - The associated value in the mapStaticDataAsArgument map
      Returns:
      this builder for use in a chained invocation
    • putMapStaticDataAsArgument

      public final StageDescriptor.Builder putMapStaticDataAsArgument(Map.Entry<String,? extends Integer> entry)
      Put one entry to the mapStaticDataAsArgument map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • mapStaticDataAsArgument

      public final StageDescriptor.Builder mapStaticDataAsArgument(Map<String,? extends Integer> entries)
      Sets or replaces all mappings from the specified map as entries for the mapStaticDataAsArgument map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the mapStaticDataAsArgument map
      Returns:
      this builder for use in a chained invocation
    • putAllMapStaticDataAsArgument

      public final StageDescriptor.Builder putAllMapStaticDataAsArgument(Map<String,? extends Integer> entries)
      Put all mappings from the specified map as entries to mapStaticDataAsArgument map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the mapStaticDataAsArgument map
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableStageDescriptor build()
      Returns:
      An immutable instance of StageDescriptor
      Throws:
      IllegalStateException - if any required attributes are missing
    • formatRequiredAttributesMessage

      private String formatRequiredAttributesMessage()