summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-04-06 13:54:44 +0000
committermihaylov <mihaylov@epfl.ch>2006-04-06 13:54:44 +0000
commit40f1882abeda9cd03612ec31f93e2d62b1b1b6c4 (patch)
tree85bba6b4114ed61f07259b73b9b32aef18cf070e /src
parent9ce18b19b66f73cd872158b6b28efd480fc5c5d1 (diff)
downloadscala-40f1882abeda9cd03612ec31f93e2d62b1b1b6c4.tar.gz
scala-40f1882abeda9cd03612ec31f93e2d62b1b1b6c4.tar.bz2
scala-40f1882abeda9cd03612ec31f93e2d62b1b1b6c4.zip
Removed the unused scala.runtime.{IOMap,FHV_Has...
Removed the unused scala.runtime.{IOMap,FHV_Hash,AtomicReference} Java classes
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/runtime/AtomicReference.java56
-rw-r--r--src/library/scala/runtime/FNV_Hash.java53
-rw-r--r--src/library/scala/runtime/IOMap.java173
3 files changed, 0 insertions, 282 deletions
diff --git a/src/library/scala/runtime/AtomicReference.java b/src/library/scala/runtime/AtomicReference.java
deleted file mode 100644
index cd5ef287be..0000000000
--- a/src/library/scala/runtime/AtomicReference.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id$
-
-
-package scala.runtime;
-
-
-/**
- * Blocking (i.e. non-atomic) placeholder for Java 1.5's
- * <code>java.util.concurrent.atomic.AtomicReference</code> class.
- */
-
-public class AtomicReference implements java.io.Serializable {
- private Object value;
-
- public AtomicReference(Object value) {
- this.value = value;
- }
-
- public Object get() {
- return value;
- }
-
- public Object getAndSet(Object update) {
- Object previousValue = value;
- value = update;
- return previousValue;
- }
-
- public void set(Object update) {
- value = update;
- }
-
- public synchronized boolean compareAndSet(Object expected, Object update) {
- if (value == expected) {
- value = update;
- return true;
- } else
- return false;
- }
-
- public boolean weakCompareAndSet(Object expected, Object update) {
- return compareAndSet(expected, update);
- }
-
- public String toString() {
- return value.toString();
- }
-}
diff --git a/src/library/scala/runtime/FNV_Hash.java b/src/library/scala/runtime/FNV_Hash.java
deleted file mode 100644
index f64eb992d6..0000000000
--- a/src/library/scala/runtime/FNV_Hash.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id$
-
-
-package scala.runtime;
-
-
-/**
- * Provide methods to compute the various kinds of Fowler / Noll / Vo
- * (FNV) hash.
- *
- * @author Michel Schinz
- */
-
-public class FNV_Hash {
- public static final int INIT = -2128831035;
-
- public static int hashStep8(int current, int newInt8) {
- return (current * 16777619) ^ newInt8;
- }
-
- public static int hashStep32(int current, int newInt32) {
- final int v1 = hashStep8(current, newInt32 >> 24);
- final int v2 = hashStep8(v1, (newInt32 >> 16) & 0xFF);
- final int v3 = hashStep8(v2, (newInt32 >> 8) & 0xFF);
- return hashStep8(v3, newInt32 & 0xFF);
- }
-
- public static int hash32(byte[] bytes) {
- final int len = bytes.length;
-
- int h = INIT;
- for (int i = 0; i < len; ++i)
- h = hashStep8(h, bytes[i]);
-
- return h;
- }
-
- public static int hash32(String str) {
- try {
- return hash32(str.getBytes("UTF-8"));
- } catch (java.io.UnsupportedEncodingException e) {
- throw new Error(e);
- }
- }
-}
diff --git a/src/library/scala/runtime/IOMap.java b/src/library/scala/runtime/IOMap.java
deleted file mode 100644
index 320da2af4e..0000000000
--- a/src/library/scala/runtime/IOMap.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id$
-
-
-package scala.runtime;
-
-
-/**
- * Purely functional maps from integers to objects. Implemented as
- * red-black trees.
- *
- * @author Michel Schinz
- * @version 1.0
- */
-
-public class IOMap implements java.io.Serializable {
-
- /** The map class itself */
- public static class T implements java.io.Serializable {
- public case N(int c, T l, T r, int k, Object v);
- public case E;
- }
-
- public static final T EMPTY = T.E;
-
- // Node colors (Black and Red)
- private static final int B = 0;
- private static final int R = 1;
-
- public static class ConflictException extends Exception {
- public final int key;
- public final Object oldValue, newValue;
-
- public ConflictException(int key, Object oldValue, Object newValue) {
- this.key = key;
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
- public Throwable fillInStackTrace() {
- // do nothing, to speed up things
- return this;
- }
- }
-
- public Object resolveConflict(int k, Object oldV, Object newV)
- throws ConflictException {
- throw new ConflictException(k, oldV, newV);
- }
-
- public T put(T map, int key, Object value) throws ConflictException {
- switch (putAux(map, key, value)) {
- case N(_, T l, T r, int k, Object v):
- return T.N(B, l, r, k, v);
- default:
- throw new Error();
- }
- }
-
- private T putAux(T map, int key, Object value) throws ConflictException {
- switch (map) {
- case N(int c, T l, T r, int k, Object v):
- if (key < k)
- return balance(T.N(c, putAux(l, key, value), r, k, v));
- else if (key > k)
- return balance(T.N(c, l, putAux(r, key, value), k, v));
- else
- return T.N(c, l, r, k, resolveConflict(k, v, value));
- case E:
- return T.N(R, T.E, T.E, key, value);
- default:
- throw new Error();
- }
- }
-
- private T balance(T t) {
- switch (t) {
- case N(B,
- N(R, N(R, T a, T b, int xK, Object xV), T c, int yK, Object yV),
- T d,
- int zK, Object zV):
- return T.N(R, T.N(B, a, b, xK, xV), T.N(B, c, d, zK, zV), yK, yV);
- case N(B,
- N(R, T a, N(R, T b, T c, int yK, Object yV), int xK, Object xV),
- T d,
- int zK, Object zV):
- return T.N(R, T.N(B, a, b, xK, xV), T.N(B, c, d, zK, zV), yK, yV);
- case N(B,
- T a,
- N(R, N(R, T b, T c, int yK, Object yV), T d, int zK, Object zV),
- int xK, Object xV):
- return T.N(R, T.N(B, a, b, xK, xV), T.N(B, c, d, zK, zV), yK, yV);
- case N(B,
- T a,
- N(R, T b, N(R, T c, T d, int zK, Object zV), int yK, Object yV),
- int xK, Object xV):
- return T.N(R, T.N(B, a, b, xK, xV), T.N(B, c, d, zK, zV), yK, yV);
- default:
- return t;
- }
- }
-
- public Object get(T map, int key) {
- switch (map) {
- case N(_, T l, T r, int k, Object v):
- if (key < k)
- return get(l, key);
- else if (key > k)
- return get(r, key);
- else
- return v;
- case E:
- return null;
- default:
- throw new Error("unexpected node " + this);
- }
- }
-
- public int size(T map) {
- switch (map) {
- case N(_, T l, T r, _, _):
- return size(l) + size(r) + 1;
- case E:
- return 0;
- default:
- throw new Error("unexpected node " + this);
- }
- }
-
- public int depth(T map) {
- switch (map) {
- case N(_, T l, T r, _, _):
- return Math.max(depth(l), depth(r)) + 1;
- case E:
- return 0;
- default:
- throw new Error("unexpected node " + this);
- }
- }
-}
-
-// class RBTest {
-// static class MyIOMap extends IOMap {
-// public Object resolveConflict(int k, Object oldV, Object newV) {
-// throw new Error("conflict!!!");
-// }
-// }
-
-// public static void main(String[] args) {
-// MyIOMap map = new MyIOMap();
-// MyIOMap.T t = map.EMPTY;
-
-// long start = System.currentTimeMillis();
-// for (int i = 0; i < args.length; ++i) {
-// t = map.put(t, FNV_Hash.hash32(args[i]), new Integer(i));
-// }
-
-// for (int i = 0; i < args.length; ++i) {
-// map.get(t, FNV_Hash.hash32(args[i]));
-// }
-// long end = System.currentTimeMillis();
-// System.out.println("time: " + (end - start) + "ms");
-
-// System.out.println("size = " + map.size(t));
-// System.out.println("depth = " + map.depth(t));
-// }
-// }