Package com.io7m.waxmill.machines
Class WXMCPUTopology.Builder
java.lang.Object
com.io7m.waxmill.machines.WXMCPUTopology.Builder
- Enclosing class:
- WXMCPUTopology
public static final class WXMCPUTopology.Builder
extends java.lang.Object
Builds instances of type
WXMCPUTopology.
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.
-
Method Summary
Modifier and Type Method Description WXMCPUTopology.BuilderaddAllPinnedCPUs(java.lang.Iterable<? extends WXMPinCPU> elements)Adds elements topinnedCPUslist.WXMCPUTopology.BuilderaddPinnedCPUs(WXMPinCPU element)Adds one element topinnedCPUslist.WXMCPUTopology.BuilderaddPinnedCPUs(WXMPinCPU... elements)Adds elements topinnedCPUslist.WXMCPUTopologybuild()Builds a newWXMCPUTopology.WXMCPUTopology.Builderfrom(WXMCPUTopologyType instance)Fill a builder with attribute values from the providedWXMCPUTopologyTypeinstance.WXMCPUTopology.BuildersetComment(java.lang.String comment)Initializes the value for thecommentattribute.WXMCPUTopology.BuildersetCores(int cores)Initializes the value for thecoresattribute.WXMCPUTopology.BuildersetCpus(int cpus)Initializes the value for thecpusattribute.WXMCPUTopology.BuildersetPinnedCPUs(java.lang.Iterable<? extends WXMPinCPU> elements)Sets or replaces all elements forpinnedCPUslist.WXMCPUTopology.BuildersetSockets(int sockets)Initializes the value for thesocketsattribute.WXMCPUTopology.BuildersetThreads(int threads)Initializes the value for thethreadsattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedWXMCPUTopologyTypeinstance. 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:
thisbuilder for use in a chained invocation
-
setSockets
Initializes the value for thesocketsattribute.If not set, this attribute will have a default value as returned by the initializer of
sockets.- Parameters:
sockets- The value for sockets- Returns:
thisbuilder for use in a chained invocation
-
setThreads
Initializes the value for thethreadsattribute.If not set, this attribute will have a default value as returned by the initializer of
threads.- Parameters:
threads- The value for threads- Returns:
thisbuilder for use in a chained invocation
-
setCores
Initializes the value for thecoresattribute.If not set, this attribute will have a default value as returned by the initializer of
cores.- Parameters:
cores- The value for cores- Returns:
thisbuilder for use in a chained invocation
-
setCpus
Initializes the value for thecpusattribute.If not set, this attribute will have a default value as returned by the initializer of
cpus.- Parameters:
cpus- The value for cpus- Returns:
thisbuilder for use in a chained invocation
-
setComment
Initializes the value for thecommentattribute.If not set, this attribute will have a default value as returned by the initializer of
comment.- Parameters:
comment- The value for comment- Returns:
thisbuilder for use in a chained invocation
-
addPinnedCPUs
Adds one element topinnedCPUslist.- Parameters:
element- A pinnedCPUs element- Returns:
thisbuilder for use in a chained invocation
-
addPinnedCPUs
Adds elements topinnedCPUslist.- Parameters:
elements- An array of pinnedCPUs elements- Returns:
thisbuilder for use in a chained invocation
-
setPinnedCPUs
public final WXMCPUTopology.Builder setPinnedCPUs(java.lang.Iterable<? extends WXMPinCPU> elements)Sets or replaces all elements forpinnedCPUslist.- Parameters:
elements- An iterable of pinnedCPUs elements- Returns:
thisbuilder for use in a chained invocation
-
addAllPinnedCPUs
public final WXMCPUTopology.Builder addAllPinnedCPUs(java.lang.Iterable<? extends WXMPinCPU> elements)Adds elements topinnedCPUslist.- Parameters:
elements- An iterable of pinnedCPUs elements- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newWXMCPUTopology.- Returns:
- An immutable instance of WXMCPUTopology
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-