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().

  • 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 interface Connection
      Returns:
      The value of the fromNodeIndex attribute
    • toNodeIndex

      public int toNodeIndex()
      Specified by:
      toNodeIndex in interface Connection
      Returns:
      The value of the toNodeIndex attribute
    • weight

      public float weight()
      Specified by:
      weight in interface Connection
      Returns:
      The value of the weight attribute
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface Connection
      Returns:
      The value of the isEnabled attribute
    • innovation

      public int innovation()
      Specified by:
      innovation in interface Connection
      Returns:
      The value of the innovation attribute
    • withFromNodeIndex

      public final ImmutableConnection withFromNodeIndex(int value)
      Copy the current immutable object by setting a value for the fromNodeIndex attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for fromNodeIndex
      Returns:
      A modified copy of the this object
    • withToNodeIndex

      public final ImmutableConnection withToNodeIndex(int value)
      Copy the current immutable object by setting a value for the toNodeIndex attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for toNodeIndex
      Returns:
      A modified copy of the this object
    • withWeight

      public final ImmutableConnection withWeight(float value)
      Copy the current immutable object by setting a value for the weight attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for weight
      Returns:
      A modified copy of the this object
    • withIsEnabled

      public final ImmutableConnection withIsEnabled(boolean value)
      Copy the current immutable object by setting a value for the isEnabled attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isEnabled
      Returns:
      A modified copy of the this object
    • withInnovation

      public final ImmutableConnection withInnovation(int value)
      Copy the current immutable object by setting a value for the innovation attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for innovation
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableConnection that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • equalTo

      private boolean equalTo(int synthetic, ImmutableConnection another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: fromNodeIndex, toNodeIndex, weight, isEnabled, innovation.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Connection with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static ImmutableConnection of(int fromNodeIndex, int toNodeIndex, float weight, boolean isEnabled, int innovation)
      Construct a new immutable Connection instance.
      Parameters:
      fromNodeIndex - The value for the fromNodeIndex attribute
      toNodeIndex - The value for the toNodeIndex attribute
      weight - The value for the weight attribute
      isEnabled - The value for the isEnabled attribute
      innovation - The value for the innovation attribute
      Returns:
      An immutable Connection instance
    • validate

      private static ImmutableConnection validate(ImmutableConnection instance)
    • copyOf

      public static ImmutableConnection copyOf(Connection instance)
      Creates an immutable copy of a Connection 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