aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/function/Subtraction.java
blob: 8f107b1d87e54b873a7db14f79b0041c50e81dab (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 Subtraction extends Function {

	@Override
	public int run(Connection... connections) {
		if (connections.length > 1) {
			return connections[0].getValue() - connections[1].getValue();
		} else {
			throw new InsufficientArgumentsException();
		}
	}

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

}