Added Scalariform sbt plugin which formats code on each compile. Also checking in reformatted code

This commit is contained in:
Jonas Bonér 2011-05-18 17:25:30 +02:00
parent 5949673092
commit a7311c83e6
177 changed files with 4184 additions and 4245 deletions

View file

@ -4,8 +4,8 @@
package akka.util
import java.lang.reflect.{Array => JArray}
import java.lang.{Float => JFloat, Double => JDouble}
import java.lang.reflect.{ Array JArray }
import java.lang.{ Float JFloat, Double JDouble }
/**
* Set of methods which allow easy implementation of <code>hashCode</code>.
@ -28,25 +28,25 @@ object HashCode {
val SEED = 23
def hash(seed: Int, any: Any): Int = any match {
case value: Boolean => hash(seed, value)
case value: Char => hash(seed, value)
case value: Short => hash(seed, value)
case value: Int => hash(seed, value)
case value: Long => hash(seed, value)
case value: Float => hash(seed, value)
case value: Double => hash(seed, value)
case value: Byte => hash(seed, value)
case value: AnyRef =>
case value: Boolean hash(seed, value)
case value: Char hash(seed, value)
case value: Short hash(seed, value)
case value: Int hash(seed, value)
case value: Long hash(seed, value)
case value: Float hash(seed, value)
case value: Double hash(seed, value)
case value: Byte hash(seed, value)
case value: AnyRef
var result = seed
if (value eq null) result = hash(result, 0)
else if (!isArray(value)) result = hash(result, value.hashCode())
else for (id <- 0 until JArray.getLength(value)) result = hash(result, JArray.get(value, id)) // is an array
else for (id 0 until JArray.getLength(value)) result = hash(result, JArray.get(value, id)) // is an array
result
}
def hash(seed: Int, value: Boolean): Int = firstTerm(seed) + (if (value) 1 else 0)
def hash(seed: Int, value: Char): Int = firstTerm(seed) + value.asInstanceOf[Int]
def hash(seed: Int, value: Int): Int = firstTerm(seed) + value
def hash(seed: Int, value: Long): Int = firstTerm(seed) + (value ^ (value >>> 32) ).asInstanceOf[Int]
def hash(seed: Int, value: Long): Int = firstTerm(seed) + (value ^ (value >>> 32)).asInstanceOf[Int]
def hash(seed: Int, value: Float): Int = hash(seed, JFloat.floatToIntBits(value))
def hash(seed: Int, value: Double): Int = hash(seed, JDouble.doubleToLongBits(value))