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 Multiply3 23 extends MathCommand { 24 25 private static final String CVS_REVISION = "$Revision: 1.5 $"; 26 27 public Multiply3(final GPConfiguration a_conf, Class a_type) 28 throws InvalidConfigurationException { 29 super(a_conf, 3, a_type); 30 } 31 32 public String toString() { 33 return "&1 * &2 * &3"; 34 } 35 36 42 public String getName() { 43 return "Multiply3"; 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_multiply3(c.execute_object(n, 1, args))).execute_multiply3( 69 c.execute_object(n, 2, args)); 70 } 71 72 protected interface Compatible { 73 public Object execute_multiply3(Object o); 74 } 75 } 76 | Popular Tags |