1 10 package org.jgap.gp.function; 11 12 import org.jgap.*; 13 import org.jgap.gp.*; 14 import org.jgap.gp.impl.*; 15 16 22 public class Add3 23 extends MathCommand { 24 25 private final static String CVS_REVISION = "$Revision: 1.5 $"; 26 27 public Add3(final GPConfiguration a_conf, Class type) 28 throws InvalidConfigurationException { 29 super(a_conf, 3, type); 30 } 31 32 public String toString() { 33 return "&1 + &2 + &3"; 34 } 35 36 42 public String getName() { 43 return "Add3"; 44 } 45 46 public int execute_int(ProgramChromosome c, int n, Object [] args) { 47 return c.execute_int(n, 0, args) + c.execute_int(n, 1, args) + 48 c.execute_int(n, 2, args); 49 } 50 51 public long execute_long(ProgramChromosome c, int n, Object [] args) { 52 return c.execute_long(n, 0, args) + c.execute_long(n, 1, args) + 53 c.execute_long(n, 2, args); 54 } 55 56 public float execute_float(ProgramChromosome c, int n, Object [] args) { 57 return c.execute_float(n, 0, args) + c.execute_float(n, 1, args) + 58 c.execute_float(n, 2, args); 59 } 60 61 public double execute_double(ProgramChromosome c, int n, Object [] args) { 62 return c.execute_double(n, 0, args) + c.execute_double(n, 1, args) + 63 c.execute_double(n, 2, args); 64 } 65 66 public Object execute_object(ProgramChromosome c, int n, Object [] args) { 67 return ( (Compatible) ( (Compatible) c.execute_object(n, 0, args)). 68 execute_add3(c.execute_object(n, 1, args))).execute_add3( 69 c.execute_object(n, 2, args)); 70 } 71 72 protected interface Compatible { 73 public Object execute_add3(Object o); 74 } 75 } 76 | Popular Tags |