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

📄 type.java

📁 主要是对串口驱动的的一些控制源码!!! 在下载javacomm20-win32.zip后就可以使用。
💻 JAVA
字号:
// Copyright <applicate>, 2002. All Rights Reserved.

// This software is the proprietary information of www.applicate.de.

// Use is subject to license terms.



package de.applicate.util.lang;







import java.io.Serializable;



/**

 * If there can be more than one instance of a class with the

 * same ID use the Type class. If not use Enum.

 * <p>

 * You should not use "==" on instances of a Type class!

 *

 * @author     hs

 * @created    2. April 2002

 * @version    $Author: mwulff $ checked in $Revision: 1.1 $ at $Date: 2003/01/16 13:04:46 $

 */

public abstract class Type extends EqualObject implements Comparable, Serializable, Cloneable, WithID {



    protected final  int  m_nID;



    //------------------------------------------------------------------------

    //  Constructors

    //------------------------------------------------------------------------



    /**

     * @param  _nID  User defined ID.<br>

     *               <b>Attention:</b>You can use the same ID twice! It's not checked!

     */

    protected Type(final int _nID) {

        m_nID = _nID;

    }



    //------------------------------------------------------------------------

    //  implemented methods from ID

    //------------------------------------------------------------------------



    public final int getID() {

        return m_nID;

    }





    public final boolean equalIDs(final WithID _id) {

        return m_nID == _id.getID();

    }



    //------------------------------------------------------------------------

    //  implemented methods from Comparable

    //------------------------------------------------------------------------



    /**

     * @param  _o  Parameter name is self-explanatory!

     * @return     <code>getID() - ((Enum)_o).getID();</code>

     */

    public int compareTo(final Object _o) {

        // not final

        return m_nID - ((WithID)_o).getID();

    }



    //------------------------------------------------------------------------

    //  implemented methods from EqualObject

    //------------------------------------------------------------------------



    /**

     * @param  _o  Parameter is of the same class as this object!

     * @return     true if the fields are equal.

     */

    protected boolean equalFields(final Object _o) {

        Type  typeParameter  = (Type)_o;

        if (m_nID == typeParameter.m_nID) {

            return true;

        }

        return false;

    }





    /**

     * @return    Returns the ID.

     */

    public int hashCode() {

        // not final

        return m_nID;

    }



    //------------------------------------------------------------------------

    //  overrided methods from Object

    //------------------------------------------------------------------------



    /**

     * @return    Returns the ID.

     */

    public String toString() {

        return Integer.toString(m_nID);

    }



}

⌨️ 快捷键说明

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