1 package net.bmahe.genetics4j.gp.program; 2 3 import java.util.Objects; 4 import java.util.Set; 5 6 import org.apache.commons.lang3.Validate; 7 import org.immutables.value.Value; 8 import org.immutables.value.Value.Parameter; 9 10 import net.bmahe.genetics4j.gp.InputSpec; 11 import net.bmahe.genetics4j.gp.OperationFactory; 12 13 @Value.Immutable 14 public abstract class Program { 15 16 @Parameter 17 public abstract Set<OperationFactory> functions(); 18 19 @Parameter 20 public abstract Set<OperationFactory> terminal(); 21 22 @Parameter 23 public abstract InputSpec inputSpec(); 24 25 @Parameter 26 public abstract int maxDepth(); 27 28 @Value.Check 29 protected void check() { 30 Objects.requireNonNull(functions()); 31 Validate.isTrue(functions().size() > 0); 32 33 Objects.requireNonNull(terminal()); 34 Validate.isTrue(terminal().size() > 0); 35 } 36 }