Class ImmutableProgram
Program
.
Use the builder to create immutable instances:
ImmutableProgram.builder()
.
Use the static factory method to create immutable instances:
ImmutableProgram.of()
.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableProgram.Builder
builder()
Creates a builder forImmutableProgram
.Returns the OpenCL compiler build options for program compilation.content()
Returns the direct OpenCL source code content as strings.static ImmutableProgram
Creates an immutable copy of aProgram
value.private static <T> List
<T> createSafeList
(Iterable<? extends T> iterable, boolean checkNulls, boolean skipNulls) private static <T> List
<T> createUnmodifiableList
(boolean clone, List<T> list) private static <T> Set
<T> createUnmodifiableSet
(List<T> list) Unmodifiable set constructed from list to avoid rehashing.boolean
This instance is equal to all instances ofImmutableProgram
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableProgram another) int
hashCode()
Computes a hash code from attributes:content
,resources
,kernelNames
,buildOptions
.Returns the names of kernels to be extracted from the compiled program.static ImmutableProgram
Construct a new immutableProgram
instance.static ImmutableProgram
Construct a new immutableProgram
instance.Returns the classpath resource paths containing OpenCL source code.toString()
Prints the immutable valueProgram
with attribute values.private static ImmutableProgram
validate
(ImmutableProgram instance) final ImmutableProgram
withBuildOptions
(String value) Copy the current immutable object by setting a present value for the optionalbuildOptions
attribute.final ImmutableProgram
withBuildOptions
(Optional<String> optional) Copy the current immutable object by setting an optional value for thebuildOptions
attribute.final ImmutableProgram
withContent
(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofcontent
.final ImmutableProgram
withContent
(String... elements) Copy the current immutable object with elements that replace the content ofcontent
.final ImmutableProgram
withKernelNames
(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofkernelNames
.final ImmutableProgram
withKernelNames
(String... elements) Copy the current immutable object with elements that replace the content ofkernelNames
.final ImmutableProgram
withResources
(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofresources
.final ImmutableProgram
withResources
(String... elements) Copy the current immutable object with elements that replace the content ofresources
.Methods inherited from class net.bmahe.genetics4j.gpu.spec.Program
check, ofContent, ofResource, ofResource
-
Field Details
-
-
resources
-
kernelNames
-
buildOptions
-
-
Constructor Details
-
ImmutableProgram
-
ImmutableProgram
-
-
Method Details
-
content
Returns the direct OpenCL source code content as strings.Content represents OpenCL C source code provided directly as strings rather than loaded from resources. Multiple content strings are concatenated during compilation to form a single compilation unit.
-
resources
Returns the classpath resource paths containing OpenCL source code.Resources are loaded from the classpath at compilation time and concatenated with any direct content to form the complete program source. Resource paths should be relative to the classpath root.
-
kernelNames
Returns the names of kernels to be extracted from the compiled program.Kernel names specify which functions in the OpenCL source should be made available as executable kernels. These names must correspond to functions declared with the
__kernel
qualifier in the source code.- Specified by:
kernelNames
in classProgram
- Returns:
- set of kernel function names to extract after compilation
-
buildOptions
Returns the OpenCL compiler build options for program compilation.Build options are passed to the OpenCL compiler to control optimization, define preprocessor macros, and configure compilation behavior. Common options include optimization levels, math optimizations, and macro definitions.
- Specified by:
buildOptions
in classProgram
- Returns:
- optional build options string for OpenCL compilation
-
withContent
Copy the current immutable object with elements that replace the content ofcontent
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withContent
Copy the current immutable object with elements that replace the content ofcontent
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of content elements to set- Returns:
- A modified copy of
this
object
-
withResources
Copy the current immutable object with elements that replace the content ofresources
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withResources
Copy the current immutable object with elements that replace the content ofresources
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of resources elements to set- Returns:
- A modified copy of
this
object
-
withKernelNames
Copy the current immutable object with elements that replace the content ofkernelNames
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withKernelNames
Copy the current immutable object with elements that replace the content ofkernelNames
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of kernelNames elements to set- Returns:
- A modified copy of
this
object
-
withBuildOptions
Copy the current immutable object by setting a present value for the optionalbuildOptions
attribute.- Parameters:
value
- The value for buildOptions- Returns:
- A modified copy of
this
object
-
withBuildOptions
Copy the current immutable object by setting an optional value for thebuildOptions
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for buildOptions- Returns:
- A modified copy of
this
object
-
equals
This instance is equal to all instances ofImmutableProgram
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:content
,resources
,kernelNames
,buildOptions
. -
toString
Prints the immutable valueProgram
with attribute values. -
of
public static ImmutableProgram of(List<String> content, Set<String> resources, Set<String> kernelNames) Construct a new immutableProgram
instance.- Parameters:
content
- The value for thecontent
attributeresources
- The value for theresources
attributekernelNames
- The value for thekernelNames
attribute- Returns:
- An immutable Program instance
-
of
public static ImmutableProgram of(Iterable<String> content, Iterable<String> resources, Iterable<String> kernelNames) Construct a new immutableProgram
instance.- Parameters:
content
- The value for thecontent
attributeresources
- The value for theresources
attributekernelNames
- The value for thekernelNames
attribute- Returns:
- An immutable Program instance
-
validate
-
copyOf
Creates an immutable copy of aProgram
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
Creates a builder forImmutableProgram
.ImmutableProgram.builder() .addContent|addAllContent(String) //
content
elements .addResources|addAllResources(String) //resources
elements .addKernelNames|addAllKernelNames(String) //kernelNames
elements .buildOptions(String) // optionalbuildOptions
.build();- Returns:
- A new ImmutableProgram builder
-
createSafeList
-
createUnmodifiableList
-
createUnmodifiableSet
Unmodifiable set constructed from list to avoid rehashing.
-