summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2007-09-22 18:40:41 +0000
committerRich Hickey <richhickey@gmail.com>2007-09-22 18:40:41 +0000
commit55831cba86713b35863c6a53f9f1d26a444e1652 (patch)
tree37c45972c0b7e6f0a93753648a4e9162fd8c87fd /src
parent6b248387e7631748011afccb65c495b635806d45 (diff)
refactoring dumping unused classes
Diffstat (limited to 'src')
-rw-r--r--src/jvm/clojure/lang/InstanceMemberInvoker.java158
-rw-r--r--src/jvm/clojure/lang/Iter.java40
-rw-r--r--src/jvm/clojure/lang/IteratorIter.java44
-rw-r--r--src/jvm/clojure/lang/Module.java65
-rw-r--r--src/jvm/clojure/lang/RT.java7
-rw-r--r--src/jvm/clojure/lang/StaticMemberInvoker.java181
-rw-r--r--src/jvm/clojure/lang/TransactionalHashMap.java254
7 files changed, 4 insertions, 745 deletions
diff --git a/src/jvm/clojure/lang/InstanceMemberInvoker.java b/src/jvm/clojure/lang/InstanceMemberInvoker.java
deleted file mode 100644
index 116067e7..00000000
--- a/src/jvm/clojure/lang/InstanceMemberInvoker.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-package clojure.lang;
-
-public class InstanceMemberInvoker implements IFn{
-final public String className;
-final public String memberName;
-
-public InstanceMemberInvoker(String className, String memberName){
- this.className = className;
- this.memberName = memberName;
-}
-
-public Object call() throws Exception{
- return invoke();
-}
-
-public Object invoke() throws Exception{
- return AFn.throwArity();
-}
-
-public Object invoke(Object obj) throws Exception{
-
- return Reflector.invokeInstanceMember(obj, memberName);
-}
-
-public Object invoke(Object obj, Object val) throws Exception{
-
- return Reflector.invokeInstanceMember(memberName, obj, val);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
- throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11) throws Exception{
- return Reflector
- .invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13)
- throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14)
- throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13, arg14);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13, arg14, arg15);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13, arg14, arg15, arg16);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18, Object arg19) throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20)
- throws Exception{
- return Reflector.invokeInstanceMember(memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20);
-}
-
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20
- , Object... args)
- throws Exception{
- throw new IllegalArgumentException("Can't call functions of more than 20 arguments");
-}
-
-public Object applyTo(ISeq arglist) throws Exception{
- return AFn.applyToHelper(this, arglist);
-}
-
-}
diff --git a/src/jvm/clojure/lang/Iter.java b/src/jvm/clojure/lang/Iter.java
deleted file mode 100644
index 5433382e..00000000
--- a/src/jvm/clojure/lang/Iter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Apr 3, 2006 10:54:14 AM */
-
-package clojure.lang;
-
-
-/**
- * Implements a sequential iteration protocol
- * <pre>
- * for(Iter i = getAnIter();i!=null;i = i.iterate())
- * {
- * //use i.valAt()
- * }
- * </pre>
- */
-public interface Iter{
-/**
- * Multiple calls to get() are allowed prior to calling iterate()
- *
- * @return the currently referenced item/element/value
- */
-public Object get();
-
-/**
- * This may destroy or otherwise invalidate the object it is called upon
- * so always capture and use the return value (even though sometimes you may find it is the same object)
- *
- * @return The next iter to use, or null if at end of sequence
- */
-public Iter iterate();
-}
diff --git a/src/jvm/clojure/lang/IteratorIter.java b/src/jvm/clojure/lang/IteratorIter.java
deleted file mode 100644
index b867f64a..00000000
--- a/src/jvm/clojure/lang/IteratorIter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Apr 3, 2006 */
-
-package clojure.lang;
-
-import java.util.Iterator;
-
-public class IteratorIter implements Iter{
-
-Iterator i;
-Object val;
-
-IteratorIter(Iterator i)
- {
- if(!i.hasNext())
- throw new IllegalStateException("Iterator must have elements to construct Iter");
- this.i = i;
- val = i.next();
- }
-
-public Object get()
- {
- return val;
- }
-
-public Iter iterate()
- {
- if(i.hasNext())
- {
- val = i.next();
- return this;
- }
- return null;
- }
-}
diff --git a/src/jvm/clojure/lang/Module.java b/src/jvm/clojure/lang/Module.java
deleted file mode 100644
index 0e0d6d91..00000000
--- a/src/jvm/clojure/lang/Module.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Mar 27, 2006 1:29:39 PM */
-
-package clojure.lang;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-public class Module{
-
-/**
- * String->Module
- */
-static final public ConcurrentHashMap<String, Module> table = new ConcurrentHashMap();
-
-/**
- * Symbol->Var
- */
-final public Ref vars = new Ref(PersistentHashMap.EMPTY);
-final public String name;
-
-Module(String name){
- this.name = name;
-}
-
-static public Module findModule(String name){
- return table.get(name);
-}
-
-static public Module findOrCreateModule(String name){
- Module module = findModule(name);
- if(module == null)
- module = table.putIfAbsent(name, new Module(name));
- return module;
-}
-
-public Ref findRef(String name) throws Exception{
- return (Ref) ((IPersistentMap) vars.get()).valAt(name);
-}
-
-public static Ref intern(String moduleName, String name) throws Exception{
- Module module = findModule(moduleName);
- if(module == null)
- throw new Exception(String.format("Module %s not found", moduleName));
- return module.intern(name);
-}
-
-public Ref intern(String name) throws Exception{
- //must be called in transaction
- IPersistentMap varmap = (IPersistentMap) vars.get();
- Ref var = (Ref) varmap.valAt(name);
- if(var == null)
- vars.set(varmap.assoc(name, var = new Ref()));
- return var;
-}
-
-}
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
index 98461733..765e704e 100644
--- a/src/jvm/clojure/lang/RT.java
+++ b/src/jvm/clojure/lang/RT.java
@@ -23,8 +23,8 @@ final static public Var OUT =
Var.intern(Symbol.create("clojure", "out"), new OutputStreamWriter(System.out));
final static Keyword TAG_KEY = Keyword.intern("clojure", "tag");
-final static public Var CURRENT_MODULE = Var.intern(Symbol.create("clojure", "current-module"),
- Module.findOrCreateModule("clojure/user"));
+//final static public Var CURRENT_MODULE = Var.intern(Symbol.create("clojure", "current-module"),
+// Module.findOrCreateModule("clojure/user"));
final static Symbol LOAD_FILE = Symbol.create("clojure", "load-file");
final static Symbol EQL_REF = Symbol.create("clojure", "eql-ref?");
@@ -357,6 +357,7 @@ static public Object assocN(int n, Object val, Object coll){
return null;
}
+/*
static public Iter iter(Object coll){
if(coll == null || coll instanceof Iter)
return (Iter) coll;
@@ -373,7 +374,7 @@ static public Iter iter(Object coll){
else
throw new IllegalArgumentException("Don't know how to create Iter from arg");
}
-
+ */
static boolean hasTag(Object o, Object tag){
if(!(o instanceof IObj))
return false;
diff --git a/src/jvm/clojure/lang/StaticMemberInvoker.java b/src/jvm/clojure/lang/StaticMemberInvoker.java
deleted file mode 100644
index 27a72bf0..00000000
--- a/src/jvm/clojure/lang/StaticMemberInvoker.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-package clojure.lang;
-
-public class StaticMemberInvoker implements IFn{
-final public String className;
-final public String memberName;
-
-public StaticMemberInvoker(String className, String memberName){
- this.className = className;
- this.memberName = memberName;
-}
-
-public Object call() throws Exception{
- return invoke();
-}
-
-public Object invoke() throws Exception{
- return Reflector.invokeStaticMethodVariadic(className, memberName);
-}
-
-public Object invoke(Object obj) throws Exception{
-
- return Reflector.invokeStaticMethodVariadic(className, memberName, obj);
-}
-
-public Object invoke(Object obj, Object val) throws Exception{
-
- return Reflector.invokeStaticMethodVariadic(className, memberName, obj, val);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3) throws Exception{
- return Reflector.invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4) throws Exception{
- return Reflector.invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws Exception{
- return Reflector.invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) throws Exception{
- return Reflector.invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
- throws Exception{
- return Reflector.invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8) throws Exception{
- return Reflector.invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13)
- throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14)
- throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13, arg14);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13, arg14, arg15);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13, arg14, arg15, arg16);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18, Object arg19) throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19);
-}
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20)
- throws Exception{
- return Reflector
- .invokeStaticMethodVariadic(className, memberName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
- arg10,
- arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20);
-}
-
-
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
- Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
- Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20
- , Object... args)
- throws Exception{
- throw new IllegalArgumentException("Can't call functions of more than 20 arguments");
-}
-
-public Object applyTo(ISeq arglist) throws Exception{
- return AFn.applyToHelper(this, arglist);
-}
-
-}
diff --git a/src/jvm/clojure/lang/TransactionalHashMap.java b/src/jvm/clojure/lang/TransactionalHashMap.java
deleted file mode 100644
index f8689cbf..00000000
--- a/src/jvm/clojure/lang/TransactionalHashMap.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Jul 31, 2007 */
-
-package clojure.lang;
-
-import java.util.*;
-import java.util.concurrent.CyclicBarrier;
-
-public class TransactionalHashMap<K, V> extends AbstractMap<K, V>{
-final Ref mapref;
-
-public TransactionalHashMap(){
- mapref = new Ref(PersistentHashMap.EMPTY);
-}
-
-public TransactionalHashMap(Map<? extends K, ? extends V> m){
- IPersistentMap map = PersistentHashMap.EMPTY;
- for(Entry<? extends K, ? extends V> e : m.entrySet())
- {
- map = map.assoc(e.getKey(), e.getValue());
- }
- mapref = new Ref(map);
-}
-
-public void commute(final K key, final IFn fn) throws Exception{
- mapref.commute(
- new AFn(){
- public Object invoke(Object arg1) throws Exception{
- IPersistentMap map = (IPersistentMap) arg1;
- V val = (V) map.valAt(key);
- return map.assoc(key, fn.invoke(val));
- }
- }
- );
-}
-
-public void commutePut(final K key, final V value){
- try
- {
- mapref.commute(
- new AFn(){
- public Object invoke(Object arg1) throws Exception{
- IPersistentMap map = (IPersistentMap) arg1;
- return map.assoc(key, value);
- }
- }
- );
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
-}
-
-public void commuteRemove(final Object key){
- try
- {
- mapref.commute(
- new AFn(){
-
- public Object invoke(Object arg1) throws Exception{
- IPersistentMap map = (IPersistentMap) arg1;
- return map.without(key);
- }
-
- public Obj withMeta(IPersistentMap meta){
- throw new UnsupportedOperationException();
- }
- }
- );
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
-}
-
-public void clear(){
- mapref.set(PersistentHashMap.EMPTY);
-}
-
-public boolean containsKey(Object key){
- return persistentMap().contains(key);
-}
-
-public V get(Object key){
- return (V) persistentMap().valAt(key);
-}
-
-public boolean isEmpty(){
- return persistentMap().count() == 0;
-}
-
-public V put(K key, V value){
- V ret = (V) persistentMap().valAt(key);
- mapref.set(persistentMap().assoc(key, value));
- return ret;
-}
-
-public V remove(Object key){
- V ret = (V) persistentMap().valAt(key);
- mapref.set(persistentMap().without(key));
- return ret;
-}
-
-public int size(){
- return persistentMap().count();
-}
-
-public IPersistentMap persistentMap(){
- return (IPersistentMap) mapref.get();
-}
-
-public Set<Entry<K, V>> entrySet(){
- return new AbstractSet<Entry<K, V>>(){
-
- public Iterator<Entry<K, V>> iterator(){
- return new Iterator<Entry<K, V>>(){
-
- ISeq seq = persistentMap().seq();
- Entry<K, V> last = null;
-
- public boolean hasNext(){
- return seq != null;
- }
-
- public Entry<K, V> next(){
- final IMapEntry e = (IMapEntry) seq.first();
- last =
- new Entry<K, V>(){
-
- public K getKey(){
- return (K) e.key();
- }
-
- public V getValue(){
- return (V) e.val();
- }
-
- public V setValue(V value){
- return put(getKey(), value);
- }
-
- };
- seq = seq.rest();
- return last;
- }
-
- public void remove(){
- mapref.set(persistentMap().without(last.getKey()));
- }
- };
- }
-
- public int size(){
- return persistentMap().count();
- }
- };
-}
-/*
-public static void main(String[] args){
- try
- {
- if(args.length != 1)
- System.err.println("Usage: TransactionalHashMap n");
- final int n = Integer.parseInt(args[0]);
- final int[] xs = {3, 5, 7};
- final TransactionalHashMap<Integer, Integer>[] maps = new TransactionalHashMap[]{
- new TransactionalHashMap<Integer, Integer>(),
- new TransactionalHashMap<Integer, Integer>(),
- new TransactionalHashMap<Integer, Integer>()};
-
- LockingTransaction.runInTransaction(new AFn(){
- public Object invoke() throws Exception{
- for(int i = 0; i < n; i++)
- for(TransactionalHashMap<Integer, Integer> map : maps)
- map.put(i, i);
- return null;
- }
- });
-
-
- final CyclicBarrier barrier = new CyclicBarrier(xs.length + 1);
-
- for(int x : xs)
- {
- final int t = x;
- new Thread(new Runnable(){
- public void run(){
- try
- {
- System.err.println("Waiting to start");
- barrier.await();
- LockingTransaction.runInTransaction(new AFn(){
- public Object invoke() throws Exception{
- for(TransactionalHashMap<Integer, Integer> map : maps)
- {
- Iterator<Entry<Integer, Integer>> iter =
- map.entrySet().iterator();
- while(iter.hasNext())
- {
- Entry<Integer, Integer> e = iter.next();
- if(e.getKey() % t == 0)
- iter.remove();
- else
- e.setValue(e.getValue() * t);
- }
- System.out.printf("%s\n", map);
- }
- return null;
- }
- });
- System.err.println("Waiting to finish");
- barrier.await();
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- }
- ).start();
- }
- System.err.println("Waiting to start");
- barrier.await();
- System.err.println("Waiting to finish");
- barrier.await();
-
-// LockingTransaction.runInTransaction(new AFn(){
-// public Object invoke() throws Exception{
-// for(TransactionalHashMap<Integer, Integer> map : maps)
-// {
-// System.out.printf("%s\n", map);
-// }
-// return null;
-// }
-// });
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
-}
-*/
-}