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

📄 chronometer.java

📁 一个agent 工具包,可以开发移动设备应用,考虑了安全措施
💻 JAVA
字号:
package SOMA.utility;

import java.util.*;

/** Classe che permette di effettuare misure di tempi.
*
* @author Livio Profiri
*/
public class Chronometer implements java.io.Serializable
{
  /** Descrizione del cronometro.
  * @serial*/
  public String Description;
  /** Istante di avvio.
  * @serial*/
  public long StartTime = 0;
  /** Istante di arresto.
  * @serial*/
  public long StopTime = 0;

  /** Cronometro vuoto. */
  public Chronometer()
  {
    this( "Chronometer" );
  }

  /** Cronometro con descrizione. */
  public Chronometer( String Description )
  {
    this.Description = Description;
  }

  /** Cronometro con descrizione, ma con gli stessi valori di un secondo cronometro. */
  public Chronometer( String Description, Chronometer other )
  {
    this.Description = Description;
    StartTime = other.StartTime;
    StopTime = other.StopTime;
  }

  /** Avvia il cronometro. */
  public void Start()
  {
    StartTime = System.currentTimeMillis();
    StopTime = 0;
  }

  /** Arresta il cronometro. */
  public void Stop()
  {
    StopTime = System.currentTimeMillis();
  }

  /** Descrizione completa dello stato. */
  public String toString()
  {
    if( StartTime == 0 )
      return Description + "[ uninitialized ]";
    if( StartTime != 0 && StopTime == 0 )
      return Description + "[Start: " + (new Date( StartTime )).toString() + " = " + StartTime +"]";
    else
      return Description + "[Start: " + (new Date( StartTime )).toString() + " = " + StartTime + ",  Stop: " + (StopTime - StartTime) + " ms]";
  }
}

⌨️ 快捷键说明

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