734: moved package objects to package.scala files

This commit is contained in:
patriknw 2011-04-05 11:35:21 +02:00
parent bb55de44a4
commit 2214c7fc88
3 changed files with 27 additions and 20 deletions

View file

@ -317,26 +317,6 @@ class FiniteDuration(val length: Long, val unit: TimeUnit) extends Duration {
override def hashCode = toNanos.asInstanceOf[Int]
}
package object duration {
implicit def intToDurationInt(n: Int) = new DurationInt(n)
implicit def longToDurationLong(n: Long) = new DurationLong(n)
implicit def doubleToDurationDouble(d: Double) = new DurationDouble(d)
implicit def pairIntToDuration(p : (Int, TimeUnit)) = Duration(p._1, p._2)
implicit def pairLongToDuration(p : (Long, TimeUnit)) = Duration(p._1, p._2)
implicit def durationToPair(d : Duration) = (d.length, d.unit)
implicit def intMult(i : Int) = new {
def *(d : Duration) = d * i
}
implicit def longMult(l : Long) = new {
def *(d : Duration) = d * l
}
implicit def doubleMult(f : Double) = new {
def *(d : Duration) = d * f
}
}
class DurationInt(n: Int) {
def nanoseconds = Duration(n, NANOSECONDS)
def nanos = Duration(n, NANOSECONDS)

View file

@ -0,0 +1,27 @@
/**
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
*/
package akka.util
import java.util.concurrent.TimeUnit
package object duration {
implicit def intToDurationInt(n: Int) = new DurationInt(n)
implicit def longToDurationLong(n: Long) = new DurationLong(n)
implicit def doubleToDurationDouble(d: Double) = new DurationDouble(d)
implicit def pairIntToDuration(p : (Int, TimeUnit)) = Duration(p._1, p._2)
implicit def pairLongToDuration(p : (Long, TimeUnit)) = Duration(p._1, p._2)
implicit def durationToPair(d : Duration) = (d.length, d.unit)
implicit def intMult(i : Int) = new {
def *(d : Duration) = d * i
}
implicit def longMult(l : Long) = new {
def *(d : Duration) = d * l
}
implicit def doubleMult(f : Double) = new {
def *(d : Duration) = d * f
}
}