1 10 package org.jgap.gp.impl; 11 12 19 public class GPProgramInfo { 20 21 private final static String CVS_REVISION = "$Revision: 1.2 $"; 22 23 private double m_fitnessValue; 24 25 private String m_toStringNorm; 26 27 private boolean m_found; 28 29 public GPProgramInfo(GPProgram a_prog, boolean a_found) { 30 m_fitnessValue = a_prog.getFitnessValueDirectly(); 31 m_toStringNorm = a_prog.toStringNorm(0); 32 m_found = a_found; 33 } 34 35 public String getToStringNorm() { 36 return m_toStringNorm; 37 } 38 39 public double getFitnessValue() { 40 return m_fitnessValue; 41 } 42 43 public boolean isFound() { 44 return m_found; 45 } 46 47 public void setFound(boolean a_found) { 48 m_found = a_found; 49 } 50 51 public boolean equals(Object a_other) { 52 GPProgramInfo other = (GPProgramInfo) a_other; 53 if (m_toStringNorm == null) { 54 if (other.m_toStringNorm == null) { 55 return true; 56 } 57 return false; 58 } 59 return m_toStringNorm.equals(other.m_toStringNorm); 60 } 61 62 public int compareTo(Object a_other) { 63 GPProgramInfo other = (GPProgramInfo) a_other; 64 if (m_toStringNorm == null) { 65 if (other.m_toStringNorm == null) { 66 return 0; 67 } 68 } 69 return m_toStringNorm.compareTo(other.m_toStringNorm); 70 } 71 } 72 | Popular Tags |