Class ImmutableStageDescriptor.Builder
java.lang.Object
net.bmahe.genetics4j.gpu.spec.fitness.multistage.ImmutableStageDescriptor.Builder
- Direct Known Subclasses:
StageDescriptor.Builder
- Enclosing class:
ImmutableStageDescriptor
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 Summary
Modifier and TypeFieldDescriptionprivate Map
<Integer, DataLoader> private static final long
private static final long
private long
private KernelExecutionContextComputer
private String
private Map
<Integer, LocalMemoryAllocator> private Map
<Integer, ResultAllocator> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableStageDescriptor
.final StageDescriptor.Builder
dataLoaders
(Map<Integer, ? extends DataLoader> entries) Sets or replaces all mappings from the specified map as entries for thedataLoaders
map.private String
final StageDescriptor.Builder
from
(StageDescriptor instance) Fill a builder with attribute values from the providedStageDescriptor
instance.final StageDescriptor.Builder
kernelExecutionContextComputer
(KernelExecutionContextComputer kernelExecutionContextComputer) Initializes the value for thekernelExecutionContextComputer
attribute.final StageDescriptor.Builder
kernelName
(String kernelName) Initializes the value for thekernelName
attribute.final StageDescriptor.Builder
localMemoryAllocators
(Map<Integer, ? extends LocalMemoryAllocator> entries) Sets or replaces all mappings from the specified map as entries for thelocalMemoryAllocators
map.final StageDescriptor.Builder
mapStaticDataAsArgument
(Map<String, ? extends Integer> entries) Sets or replaces all mappings from the specified map as entries for themapStaticDataAsArgument
map.final StageDescriptor.Builder
putAllDataLoaders
(Map<Integer, ? extends DataLoader> entries) Put all mappings from the specified map as entries todataLoaders
map.final StageDescriptor.Builder
putAllLocalMemoryAllocators
(Map<Integer, ? extends LocalMemoryAllocator> entries) Put all mappings from the specified map as entries tolocalMemoryAllocators
map.final StageDescriptor.Builder
putAllMapStaticDataAsArgument
(Map<String, ? extends Integer> entries) Put all mappings from the specified map as entries tomapStaticDataAsArgument
map.final StageDescriptor.Builder
putAllResultAllocators
(Map<Integer, ? extends ResultAllocator> entries) Put all mappings from the specified map as entries toresultAllocators
map.final StageDescriptor.Builder
putAllReusePreviousResultAsArguments
(Map<Integer, ? extends Integer> entries) Put all mappings from the specified map as entries toreusePreviousResultAsArguments
map.final StageDescriptor.Builder
putAllReusePreviousResultSizeAsArguments
(Map<Integer, ? extends Integer> entries) Put all mappings from the specified map as entries toreusePreviousResultSizeAsArguments
map.final StageDescriptor.Builder
putDataLoaders
(int key, DataLoader value) Put one entry to thedataLoaders
map.final StageDescriptor.Builder
putDataLoaders
(Map.Entry<Integer, ? extends DataLoader> entry) Put one entry to thedataLoaders
map.final StageDescriptor.Builder
putLocalMemoryAllocators
(int key, LocalMemoryAllocator value) Put one entry to thelocalMemoryAllocators
map.final StageDescriptor.Builder
putLocalMemoryAllocators
(Map.Entry<Integer, ? extends LocalMemoryAllocator> entry) Put one entry to thelocalMemoryAllocators
map.final StageDescriptor.Builder
putMapStaticDataAsArgument
(String key, int value) Put one entry to themapStaticDataAsArgument
map.final StageDescriptor.Builder
putMapStaticDataAsArgument
(Map.Entry<String, ? extends Integer> entry) Put one entry to themapStaticDataAsArgument
map.final StageDescriptor.Builder
putResultAllocators
(int key, ResultAllocator value) Put one entry to theresultAllocators
map.final StageDescriptor.Builder
putResultAllocators
(Map.Entry<Integer, ? extends ResultAllocator> entry) Put one entry to theresultAllocators
map.final StageDescriptor.Builder
putReusePreviousResultAsArguments
(int key, int value) Put one entry to thereusePreviousResultAsArguments
map.final StageDescriptor.Builder
putReusePreviousResultAsArguments
(Map.Entry<Integer, ? extends Integer> entry) Put one entry to thereusePreviousResultAsArguments
map.final StageDescriptor.Builder
putReusePreviousResultSizeAsArguments
(int key, int value) Put one entry to thereusePreviousResultSizeAsArguments
map.final StageDescriptor.Builder
putReusePreviousResultSizeAsArguments
(Map.Entry<Integer, ? extends Integer> entry) Put one entry to thereusePreviousResultSizeAsArguments
map.final StageDescriptor.Builder
resultAllocators
(Map<Integer, ? extends ResultAllocator> entries) Sets or replaces all mappings from the specified map as entries for theresultAllocators
map.final StageDescriptor.Builder
reusePreviousResultAsArguments
(Map<Integer, ? extends Integer> entries) Sets or replaces all mappings from the specified map as entries for thereusePreviousResultAsArguments
map.final StageDescriptor.Builder
reusePreviousResultSizeAsArguments
(Map<Integer, ? extends Integer> entries) Sets or replaces all mappings from the specified map as entries for thereusePreviousResultSizeAsArguments
map.
-
Field Details
-
INIT_BIT_KERNEL_NAME
private static final long INIT_BIT_KERNEL_NAME- See Also:
-
INIT_BIT_KERNEL_EXECUTION_CONTEXT_COMPUTER
private static final long INIT_BIT_KERNEL_EXECUTION_CONTEXT_COMPUTER- See Also:
-
initBits
private long initBits -
kernelName
-
kernelExecutionContextComputer
-
dataLoaders
-
localMemoryAllocators
-
resultAllocators
-
reusePreviousResultAsArguments
-
reusePreviousResultSizeAsArguments
-
mapStaticDataAsArgument
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forImmutableStageDescriptor
instances.new StageDescriptor.Builder() .kernelName(String) // required
kernelName
.kernelExecutionContextComputer(net.bmahe.genetics4j.gpu.spec.fitness.kernelcontext.KernelExecutionContextComputer) // requiredkernelExecutionContextComputer
.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
Fill a builder with attribute values from the providedStageDescriptor
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
Initializes the value for thekernelName
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 thekernelExecutionContextComputer
attribute.- Parameters:
kernelExecutionContextComputer
- The value for kernelExecutionContextComputer- Returns:
this
builder for use in a chained invocation
-
putDataLoaders
Put one entry to thedataLoaders
map.- Parameters:
key
- The key in the dataLoaders mapvalue
- The associated value in the dataLoaders map- Returns:
this
builder for use in a chained invocation
-
putDataLoaders
Put one entry to thedataLoaders
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
dataLoaders
Sets or replaces all mappings from the specified map as entries for thedataLoaders
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
Put all mappings from the specified map as entries todataLoaders
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
Put one entry to thelocalMemoryAllocators
map.- Parameters:
key
- The key in the localMemoryAllocators mapvalue
- 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 thelocalMemoryAllocators
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 thelocalMemoryAllocators
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 tolocalMemoryAllocators
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
Put one entry to theresultAllocators
map.- Parameters:
key
- The key in the resultAllocators mapvalue
- 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 theresultAllocators
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 theresultAllocators
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 toresultAllocators
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
Put one entry to thereusePreviousResultAsArguments
map.- Parameters:
key
- The key in the reusePreviousResultAsArguments mapvalue
- 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 thereusePreviousResultAsArguments
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 thereusePreviousResultAsArguments
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 toreusePreviousResultAsArguments
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
Put one entry to thereusePreviousResultSizeAsArguments
map.- Parameters:
key
- The key in the reusePreviousResultSizeAsArguments mapvalue
- 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 thereusePreviousResultSizeAsArguments
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 thereusePreviousResultSizeAsArguments
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 toreusePreviousResultSizeAsArguments
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
Put one entry to themapStaticDataAsArgument
map.- Parameters:
key
- The key in the mapStaticDataAsArgument mapvalue
- 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 themapStaticDataAsArgument
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
mapStaticDataAsArgument
Sets or replaces all mappings from the specified map as entries for themapStaticDataAsArgument
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 tomapStaticDataAsArgument
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
Builds a newImmutableStageDescriptor
.- Returns:
- An immutable instance of StageDescriptor
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-