⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codon.java

📁 经典的货郎担问题解决办法
💻 JAVA
字号:
/*** This code was written by Kent Paul Dolan.  See accompanying file** TravellerDoc.html for status for your use.*/package com.well.www.user.xanthian.java.genetic;import com.coyotegulch.tools.*;import com.coyotegulch.genetic.*;import com.well.www.user.xanthian.java.structures.*;import com.well.www.user.xanthian.java.tools.*;import com.well.www.user.xanthian.java.ui.*;public class Codon extends Object implements Sortable, Cloneable{  private Integer m_datum = null;/*  public Object clone()  {    return ( (Object) ((Codon)this).clone() );  }*/  public String toString()  {    if ( this.m_datum == null )    {      return new String( "(null Codon)" );    }    else    {      return this.m_datum.toString();    }  }  public int compareTo( Object that )  {    if ( this.get() < ((Codon)that).get() )    {      return Sortable.THIS_LESS_THAN;    }    if ( this.get() > ((Codon)that).get() )    {      return Sortable.THIS_GREATER_THAN;    }    return Sortable.THIS_EQUAL_TO;  }  public void swap( Object object_1 , Object object_2 )  {    if (CheckBoxControls.getState(CheckBoxControls.CBC_DEBUG_PRINTOUTS))    {      System.out.println      (        "Entered Codon.swap(Object object_1 , Object object_2) "        + ((Codon)object_1).get()        + ", "        + ((Codon)object_2).get()      );    }    Object temp = null;    try    {      temp     = (Object) ((Codon)object_1).clone();      object_1 = (Object) ((Codon)object_2).clone();      object_2 = (Object) ((Codon)temp    ).clone();    }    catch (Exception e) {}  }  public  Codon( int initialValue )  {/*    if (CheckBoxControls.getState(CheckBoxControls.CBC_DEBUG_PRINTOUTS))    {      System.out.println      (        "Entered Codon Constructor via int value "        + initialValue      );    }*/    this.m_datum = new java.lang.Integer( initialValue );  }  public  Codon( Codon that )  {/*    if (CheckBoxControls.getState(CheckBoxControls.CBC_DEBUG_PRINTOUTS))    {      System.out.println      (        "Entered Codon Constructor via another Codon's value "        + that.get()      );    }*/    this.m_datum = new Integer( that.get() );  }  public  int get()  {/*    if (CheckBoxControls.getState(CheckBoxControls.CBC_DEBUG_PRINTOUTS))    {      System.out.println      (        "Entered Codon.get() "        + m_datum.intValue()      );    }*/    return m_datum.intValue();  }  public void set( int value )  {/*    if (CheckBoxControls.getState(CheckBoxControls.CBC_DEBUG_PRINTOUTS))    {      System.out.println      (        "Entered Codon.set(int value) = "        + value      );    }*/    try    {      this.m_datum = new Integer( value );    }    catch (Exception CodonSet)    {      if (CheckBoxControls.getState(CheckBoxControls.CBC_DEBUG_PRINTOUTS))      {        System.out.println        (          "in Codon.set(int value), caught an exception CodonSet"        );      }    }  }  public void set( Codon that )  {/*    if (CheckBoxControls.getState(CheckBoxControls.CBC_DEBUG_PRINTOUTS))    {      System.out.println      (        "Entered Codon.set(Codon that) = "        + that.get()      );    }*/    this.m_datum = new Integer( that.get() );  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -