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

📄 stringid.java

📁 Java游戏高级编程!!很不错的!!!Java游戏高级编程!!很不错的
💻 JAVA
字号:
     package com.croftsoft.core.util.id;     import com.croftsoft.core.lang.NullArgumentException;

     /*********************************************************************
     * An Id implementation backed by a String.
     *
     * @version
     *   2003-06-07     * @since
     *   2000-01-16     * @author
     *   <a href="http://www.croftsoft.com/">David Wallace Croft</a>
     *********************************************************************/

     public class  StringId       implements Id
     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     {

     private static final long  serialVersionUID = 0L;     //

     private final String  s;

     //////////////////////////////////////////////////////////////////////
     // constructor method
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************     * Main constructor.     *
     * @throws NullArgumentException
     *
     *   If argument is null.
     *********************************************************************/
     public  StringId ( String  s )
     //////////////////////////////////////////////////////////////////////
     {       NullArgumentException.check ( this.s = s );
     }

     //////////////////////////////////////////////////////////////////////
     // accessor method
     //////////////////////////////////////////////////////////////////////

     public String  getS ( ) { return s; }

     //////////////////////////////////////////////////////////////////////
     // Id interface methods
     //////////////////////////////////////////////////////////////////////

     public boolean  equals ( Object  other )
     //////////////////////////////////////////////////////////////////////
     {
       if ( other == null ) return false;

       if ( !getClass ( ).equals ( other.getClass ( ) ) ) return false;

       return s.equals ( ( ( StringId ) other ).s );
     }

     public int  hashCode ( )
     //////////////////////////////////////////////////////////////////////
     {
       return s.hashCode ( );
     }

     public Object  clone ( )
     //////////////////////////////////////////////////////////////////////
     {
       try
       {
         return super.clone ( );
       }
       catch ( CloneNotSupportedException  ex )
       {
         // This will never happen.

         throw new RuntimeException ( );
       }
     }

     //////////////////////////////////////////////////////////////////////
     // Other methods
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************
     * return s;
     *********************************************************************/
     public String  toString ( )
     //////////////////////////////////////////////////////////////////////
     {
       return s;
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     }

⌨️ 快捷键说明

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