1 10 package examples.supergene; 11 12 import org.jgap.*; 13 import org.jgap.impl.*; 14 import org.jgap.supergenes.*; 15 16 23 public class NickelsPenniesSupergene 24 extends AbstractSupergene { 25 26 private final static String CVS_REVISION = "$Revision: 1.2 $"; 27 28 36 public NickelsPenniesSupergene() 37 throws InvalidConfigurationException { 38 super(); 39 } 40 41 public NickelsPenniesSupergene(final Configuration a_conf) 42 throws InvalidConfigurationException { 43 super(a_conf); 44 } 45 46 public NickelsPenniesSupergene(final Configuration a_conf, Gene[] a_genes) 47 throws InvalidConfigurationException { 48 super(a_conf, a_genes); 49 } 50 51 public boolean isValid(Gene[] a_genes, Supergene a_supergene) { 52 IntegerGene nickels = (IntegerGene) a_genes[0]; 53 IntegerGene pennies = (IntegerGene) a_genes[1]; 54 boolean valid = nickels.intValue() % 2 == pennies.intValue() % 2; 55 return valid; 56 } 57 } 58 | Popular Tags |