Class Connection
java.lang.Object
com.github.raimannma.architecture.Connection
public class Connection extends Object
The type Connection.
- Author:
- Manuel Raimann
-
Field Summary
-
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
static Connection
fromJSON(com.google.gson.JsonObject jsonObject, List<Node> nodes)
Convert a JsonObject to a connection.protected @NotNull Double[]
getConnectionData()
Stores connection data in an array.static int
getInnovationID(int a, int b)
Get innovation ID.int
hashCode()
boolean
isGated()
boolean
isSelfConnection()
com.google.gson.JsonObject
toJSON()
Converts the connection to a JsonObject that can later be converted back.String
toString()
-
Field Details
-
Method Details
-
getInnovationID
public static int getInnovationID(int a, int b)Get innovation ID. Encode two integers into a single integer.- Parameters:
a
- the first integerb
- the second integer- Returns:
- An Integer that uniquely represents a pair of Integers
- See Also:
- (Cantor pairing function)|Pairing function (Cantor pairing function)}
-
fromJSON
Convert a JsonObject to a connection.- Parameters:
jsonObject
- the json object which holds the informationnodes
- will be used to get the from, to and gate node from- Returns:
- the connection created from the information of the json object
-
getConnectionData
Stores connection data in an array. Used for crossover.ConnectionData [0] weight value [1] node from index [2] node to index [3] gate node index
- Returns:
- array containing information about the connection
-
toJSON
public com.google.gson.JsonObject toJSON()Converts the connection to a JsonObject that can later be converted back.- Returns:
- the created JsonObject
-
equals
-
hashCode
public int hashCode() -
toString
-
isSelfConnection
public boolean isSelfConnection() -
isGated
public boolean isGated()
-