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

📄 abstracttimer.scala

📁 JAVA 语言的函数式编程扩展
💻 SCALA
字号:
/*                     __                                               *\**     ________ ___   / /  ___     Scala API                            ****    / __/ __// _ | / /  / _ |    (c) 2002-2007, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */// $Id: AbstractTimer.scala 11100 2007-05-21 08:32:16Z michelou $package scala.tools.utilimport compat.Platform.currentTimeimport scala.collection.mutable.Stack/** * This abstract class implements the collection of timings. How the * collected timings are issued has to be implemented in subclasses. * * @author Philippe Altherr * @version 1.0 */abstract class AbstractTimer {  //########################################################################  // Private Fields  /** A stack for maintaining start times */  private val starts = new Stack[Long]()  //########################################################################  // Public Methods  /** Issues a timing information (duration in milliseconds). */  def issue(message: String, duration: Long): Unit  /** Starts a new timer. */  def start() {    starts += currentTime  }  /** Ends the current timer. */  def stop(message: String) {    val stop = currentTime    issue(message, stop - starts.pop)  }  /** Drops the current timer. */  def drop() {    starts.pop  }    //########################################################################}

⌨️ 快捷键说明

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