Package net.bmahe.genetics4j.neat
Class ImmutableConnection.Builder
java.lang.Object
net.bmahe.genetics4j.neat.ImmutableConnection.Builder
- Direct Known Subclasses:
Connection.Builder
- Enclosing class:
ImmutableConnection
@Generated(from="Connection",
generator="Immutables")
public static class ImmutableConnection.Builder
extends Object
Builds instances of type
Connection.
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
FieldsModifier and TypeFieldDescriptionprivate intprivate static final longprivate static final longprivate static final longprivate static final longprivate static final longprivate longprivate intprivate booleanprivate intprivate float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newConnection.private Stringfinal Connection.Builderfrom(Connection instance) Fill a builder with attribute values from the providedConnectioninstance.final Connection.BuilderfromNodeIndex(int fromNodeIndex) Initializes the value for thefromNodeIndexattribute.final Connection.Builderinnovation(int innovation) Initializes the value for theinnovationattribute.final Connection.BuilderisEnabled(boolean isEnabled) Initializes the value for theisEnabledattribute.final Connection.BuildertoNodeIndex(int toNodeIndex) Initializes the value for thetoNodeIndexattribute.final Connection.Builderweight(float weight) Initializes the value for theweightattribute.
-
Field Details
-
INIT_BIT_FROM_NODE_INDEX
private static final long INIT_BIT_FROM_NODE_INDEX- See Also:
-
INIT_BIT_TO_NODE_INDEX
private static final long INIT_BIT_TO_NODE_INDEX- See Also:
-
INIT_BIT_WEIGHT
private static final long INIT_BIT_WEIGHT- See Also:
-
INIT_BIT_IS_ENABLED
private static final long INIT_BIT_IS_ENABLED- See Also:
-
INIT_BIT_INNOVATION
private static final long INIT_BIT_INNOVATION- See Also:
-
initBits
private long initBits -
fromNodeIndex
private int fromNodeIndex -
toNodeIndex
private int toNodeIndex -
weight
private float weight -
isEnabled
private boolean isEnabled -
innovation
private int innovation
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forConnectioninstances.new Connection.Builder() .fromNodeIndex(int) // requiredfromNodeIndex.toNodeIndex(int) // requiredtoNodeIndex.weight(float) // requiredweight.isEnabled(boolean) // requiredisEnabled.innovation(int) // requiredinnovation.build();
-
-
Method Details
-
from
Fill a builder with attribute values from the providedConnectioninstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
fromNodeIndex
Initializes the value for thefromNodeIndexattribute.- Parameters:
fromNodeIndex- The value for fromNodeIndex- Returns:
thisbuilder for use in a chained invocation
-
toNodeIndex
Initializes the value for thetoNodeIndexattribute.- Parameters:
toNodeIndex- The value for toNodeIndex- Returns:
thisbuilder for use in a chained invocation
-
weight
Initializes the value for theweightattribute.- Parameters:
weight- The value for weight- Returns:
thisbuilder for use in a chained invocation
-
isEnabled
Initializes the value for theisEnabledattribute.- Parameters:
isEnabled- The value for isEnabled- Returns:
thisbuilder for use in a chained invocation
-
innovation
Initializes the value for theinnovationattribute.- Parameters:
innovation- The value for innovation- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newConnection.- Returns:
- An immutable instance of Connection
- Throws:
IllegalStateException- if any required attributes are missing
-
formatRequiredAttributesMessage
-