Package net.bmahe.genetics4j.neat
Class ImmutableConnection
java.lang.Object
net.bmahe.genetics4j.neat.ImmutableConnection
- All Implemented Interfaces:
Connection
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableConnection
extends Object
implements Connection
Immutable implementation of
Connection
.
Use the builder to create immutable instances:
new Connection.Builder()
.
Use the static factory method to create immutable instances:
ImmutableConnection.of()
.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
private final int
private final boolean
private final int
private final float
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutableConnection
(int fromNodeIndex, int toNodeIndex, float weight, boolean isEnabled, int innovation) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableConnection
copyOf
(Connection instance) Creates an immutable copy of aConnection
value.boolean
This instance is equal to all instances ofImmutableConnection
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableConnection another) int
int
hashCode()
Computes a hash code from attributes:fromNodeIndex
,toNodeIndex
,weight
,isEnabled
,innovation
.int
boolean
static ImmutableConnection
of
(int fromNodeIndex, int toNodeIndex, float weight, boolean isEnabled, int innovation) Construct a new immutableConnection
instance.int
toString()
Prints the immutable valueConnection
with attribute values.private static ImmutableConnection
validate
(ImmutableConnection instance) float
weight()
final ImmutableConnection
withFromNodeIndex
(int value) Copy the current immutable object by setting a value for thefromNodeIndex
attribute.final ImmutableConnection
withInnovation
(int value) Copy the current immutable object by setting a value for theinnovation
attribute.final ImmutableConnection
withIsEnabled
(boolean value) Copy the current immutable object by setting a value for theisEnabled
attribute.final ImmutableConnection
withToNodeIndex
(int value) Copy the current immutable object by setting a value for thetoNodeIndex
attribute.final ImmutableConnection
withWeight
(float value) Copy the current immutable object by setting a value for theweight
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.bmahe.genetics4j.neat.Connection
check
-
Field Details
-
fromNodeIndex
private final int fromNodeIndex -
toNodeIndex
private final int toNodeIndex -
weight
private final float weight -
isEnabled
private final boolean isEnabled -
innovation
private final int innovation
-
-
Constructor Details
-
ImmutableConnection
private ImmutableConnection(int fromNodeIndex, int toNodeIndex, float weight, boolean isEnabled, int innovation)
-
-
Method Details
-
fromNodeIndex
public int fromNodeIndex()- Specified by:
fromNodeIndex
in interfaceConnection
- Returns:
- The value of the
fromNodeIndex
attribute
-
toNodeIndex
public int toNodeIndex()- Specified by:
toNodeIndex
in interfaceConnection
- Returns:
- The value of the
toNodeIndex
attribute
-
weight
public float weight()- Specified by:
weight
in interfaceConnection
- Returns:
- The value of the
weight
attribute
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceConnection
- Returns:
- The value of the
isEnabled
attribute
-
innovation
public int innovation()- Specified by:
innovation
in interfaceConnection
- Returns:
- The value of the
innovation
attribute
-
withFromNodeIndex
Copy the current immutable object by setting a value for thefromNodeIndex
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for fromNodeIndex- Returns:
- A modified copy of the
this
object
-
withToNodeIndex
Copy the current immutable object by setting a value for thetoNodeIndex
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for toNodeIndex- Returns:
- A modified copy of the
this
object
-
withWeight
Copy the current immutable object by setting a value for theweight
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for weight- Returns:
- A modified copy of the
this
object
-
withIsEnabled
Copy the current immutable object by setting a value for theisEnabled
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for isEnabled- Returns:
- A modified copy of the
this
object
-
withInnovation
Copy the current immutable object by setting a value for theinnovation
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for innovation- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableConnection
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:fromNodeIndex
,toNodeIndex
,weight
,isEnabled
,innovation
. -
toString
Prints the immutable valueConnection
with attribute values. -
of
public static ImmutableConnection of(int fromNodeIndex, int toNodeIndex, float weight, boolean isEnabled, int innovation) Construct a new immutableConnection
instance.- Parameters:
fromNodeIndex
- The value for thefromNodeIndex
attributetoNodeIndex
- The value for thetoNodeIndex
attributeweight
- The value for theweight
attributeisEnabled
- The value for theisEnabled
attributeinnovation
- The value for theinnovation
attribute- Returns:
- An immutable Connection instance
-
validate
-
copyOf
Creates an immutable copy of aConnection
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 Connection instance
-