aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/function/Addition.java
blob: 8c1e0b5261174bca71bef7f3e23b214e8cbaa33a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package jcgp.function;

import jcgp.population.Connection;

public class Addition extends Function {

	@Override
	public int run(Connection... connections) {
		if (connections.length > 0) {
			return connections[0].evaluate() + connections[1].evaluate();
		} else {
			return 0;
		}
	}

	@Override
	public int getArity() {
		return 2;
	}

}