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.Builderbuilder()Creates a builder forProgram.Returns the OpenCL compiler build options for program compilation.content()Returns the direct OpenCL source code content as strings.static ProgramCreates an immutable copy of aProgramvalue.private static <T> List<T> createSafeList(Iterable<? extends T> iterable, boolean checkNulls, boolean skipNulls) private static <T> List<T> createUnmodifiableList(boolean clone, List<? extends T> list) private static <T> Set<T> createUnmodifiableSet(List<? extends T> list) Unmodifiable set constructed from list to avoid rehashing.booleanThis instance is equal to all instances ofImmutableProgramthat have equal attribute values.private booleanequalsByValue(ImmutableProgram another) inthashCode()Computes a hash code from attributes:content,resources,kernelNames,buildOptions.Returns the names of kernels to be extracted from the compiled program.static ProgramConstruct a new immutablePrograminstance.static ProgramConstruct a new immutablePrograminstance.Returns the classpath resource paths containing OpenCL source code.toString()Prints the immutable valueProgramwith attribute values.private static ImmutableProgramvalidate(ImmutableProgram instance) final ImmutableProgramwithBuildOptions(String value) Copy the current immutable object by setting a present value for the optionalbuildOptionsattribute.final ImmutableProgramwithBuildOptions(Optional<String> optional) Copy the current immutable object by setting an optional value for thebuildOptionsattribute.final ImmutableProgramwithContent(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofcontent.final ImmutableProgramwithContent(String... elements) Copy the current immutable object with elements that replace the content ofcontent.final ImmutableProgramwithKernelNames(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofkernelNames.final ImmutableProgramwithKernelNames(String... elements) Copy the current immutable object with elements that replace the content ofkernelNames.final ImmutableProgramwithResources(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofresources.final ImmutableProgramwithResources(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
__kernelqualifier in the source code.- Specified by:
kernelNamesin 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:
buildOptionsin 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
thisobject
-
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 or
thisif not changed
-
withResources
Copy the current immutable object with elements that replace the content ofresources.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
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 or
thisif not changed
-
withKernelNames
Copy the current immutable object with elements that replace the content ofkernelNames.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
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 or
thisif not changed
-
withBuildOptions
Copy the current immutable object by setting a present value for the optionalbuildOptionsattribute.- Parameters:
value- The value for buildOptions- Returns:
- A modified copy or
thisif not changed
-
withBuildOptions
Copy the current immutable object by setting an optional value for thebuildOptionsattribute. An equality check is used on inner value to prevent copying of the same value by returningthis.- Parameters:
optional- An optional value for buildOptions- Returns:
- A modified copy or
thisif not changed
-
equals
This instance is equal to all instances ofImmutableProgramthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:content,resources,kernelNames,buildOptions. -
toString
Prints the immutable valueProgramwith attribute values. -
of
Construct a new immutablePrograminstance.- Parameters:
content- The value for thecontentattributeresources- The value for theresourcesattributekernelNames- The value for thekernelNamesattribute- Returns:
- An immutable Program instance
-
of
public static Program of(Iterable<String> content, Iterable<String> resources, Iterable<String> kernelNames) Construct a new immutablePrograminstance.- Parameters:
content- The value for thecontentattributeresources- The value for theresourcesattributekernelNames- The value for thekernelNamesattribute- Returns:
- An immutable Program instance
-
validate
-
copyOf
Creates an immutable copy of aProgramvalue. 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 forProgram.ImmutableProgram.builder() .addContent|addAllContent(String) //contentelements .addResources|addAllResources(String) //resourceselements .addKernelNames|addAllKernelNames(String) //kernelNameselements .buildOptions(Optional<String>) // optionalbuildOptions.build();- Returns:
- A new Program builder
-
createSafeList
-
createUnmodifiableList
-
createUnmodifiableSet
Unmodifiable set constructed from list to avoid rehashing.
-