diff options
| author | Rich Hickey <richhickey@gmail.com> | 2006-05-31 19:45:49 +0000 |
|---|---|---|
| committer | Rich Hickey <richhickey@gmail.com> | 2006-05-31 19:45:49 +0000 |
| commit | 19d311642fa821d51365a551756146336c24a270 (patch) | |
| tree | 94e157f6e5b1bdd16940b7ef19904373371a34c9 /src/cli | |
| parent | 00d88b349cff1b49b8026add38bb62407232ce31 (diff) | |
added IObj
Diffstat (limited to 'src/cli')
| -rw-r--r-- | src/cli/runtime/IObj.cs | 10 | ||||
| -rw-r--r-- | src/cli/runtime/Keyword.cs | 2 | ||||
| -rw-r--r-- | src/cli/runtime/Obj.cs | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/cli/runtime/IObj.cs b/src/cli/runtime/IObj.cs new file mode 100644 index 00000000..3362ead2 --- /dev/null +++ b/src/cli/runtime/IObj.cs @@ -0,0 +1,10 @@ +using System;
+namespace org.clojure.runtime
+ {
+ interface IObj
+ {
+ object put(IComparable key, object val);
+ object get(IComparable key);
+ bool has(IComparable key);
+ }
+ }
diff --git a/src/cli/runtime/Keyword.cs b/src/cli/runtime/Keyword.cs index f0c6a150..903d8ea4 100644 --- a/src/cli/runtime/Keyword.cs +++ b/src/cli/runtime/Keyword.cs @@ -24,7 +24,7 @@ internal Keyword(String name):base(name)
{
}
public Object invoke(ThreadLocal }
/**
* Indexer implements IFn for attr access
* This single arg version is the getter
* @param tld
* @param obj - must be AMap
* @return the value of the attr or nil if not found
*/
public Object invoke(ThreadLocalData tld, Object obj) /*throws Exception*/
{
if (obj == null)
return null;
- return ((Obj)obj).get(this);
}
/**
* Indexer implements IFn for attr access
* This two arg version is the setter
* @param tld
* @param obj - must be AMap
* @param val
* @return val
*/
public Object invoke(ThreadLocalData tld, Object obj, Object val) /*throws Exception*/
{
return ((Obj)obj).put(this,val);
} + return ((IObj)obj).get(this);
}
/**
* Indexer implements IFn for attr access
* This two arg version is the setter
* @param tld
* @param obj - must be AMap
* @param val
* @return val
*/
public Object invoke(ThreadLocalData tld, Object obj, Object val) /*throws Exception*/
{
return ((IObj)obj).put(this,val);
} public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3) /*throws Exception*/
{
diff --git a/src/cli/runtime/Obj.cs b/src/cli/runtime/Obj.cs index 9a165e67..8f73335e 100644 --- a/src/cli/runtime/Obj.cs +++ b/src/cli/runtime/Obj.cs @@ -16,7 +16,7 @@ using System.Collections.Specialized; namespace org.clojure.runtime
{ -public class Obj
+public class Obj : IObj
{ HybridDictionary attrs; |
