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

📄 counter.java

📁 CroftSoft Code Library是一个开源的可移植的纯Java游戏库
💻 JAVA
字号:
     package com.croftsoft.core.math;

     import java.io.Serializable;
     import java.math.BigInteger;

     import com.croftsoft.core.lang.NullArgumentException;

     /*********************************************************************
     * An incrementable integer counter with no maximum limit.
     *
     * <p />
     *    
     * @version
     *   2001-03-30
     * @since
     *   2001-03-30
     * @author
     *   <a href="http://www.alumni.caltech.edu/~croft/">David W. Croft</a>
     *********************************************************************/

     public final class  Counter
       implements Serializable
     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     {

     private static final long  serialVersionUID = 1L;

     private BigInteger  count;

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     public  Counter ( BigInteger  count )
     //////////////////////////////////////////////////////////////////////
     {
       NullArgumentException.check ( this.count = count );
     }

     public  Counter ( )
     //////////////////////////////////////////////////////////////////////
     {
       this ( BigInteger.ZERO );
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     public BigInteger  getCount ( )
     //////////////////////////////////////////////////////////////////////
     {
       return count;
     }

     /*********************************************************************
     * Synchronized.
     *********************************************************************/
     public synchronized BigInteger  increment ( )
     //////////////////////////////////////////////////////////////////////
     {
       return ( count = count.add ( BigInteger.ONE ) );
     }

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

⌨️ 快捷键说明

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