Mercurial > lasercutter
view src/clojure/lang/ATransientSet.java @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 /**2 * Copyright (c) Rich Hickey. All rights reserved.3 * The use and distribution terms for this software are covered by the4 * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)5 * which can be found in the file epl-v10.html at the root of this distribution.6 * By using this software in any fashion, you are agreeing to be bound by7 * the terms of this license.8 * You must not remove this notice, or any other, from this software.9 **/11 /* rich Mar 3, 2008 */13 package clojure.lang;15 public abstract class ATransientSet extends AFn implements ITransientSet{16 ITransientMap impl;18 ATransientSet(ITransientMap impl) {19 this.impl = impl;20 }22 public int count() {23 return impl.count();24 }26 public ITransientSet conj(Object val) {27 ITransientMap m = impl.assoc(val, val);28 if (m != impl) this.impl = m;29 return this;30 }32 public boolean contains(Object key) {33 return this != impl.valAt(key, this);34 }36 public ITransientSet disjoin(Object key) throws Exception {37 ITransientMap m = impl.without(key);38 if (m != impl) this.impl = m;39 return this;40 }42 public Object get(Object key) {43 return impl.valAt(key);44 }46 public Object invoke(Object key, Object notFound) throws Exception {47 return impl.valAt(key, notFound);48 }50 public Object invoke(Object key) throws Exception {51 return impl.valAt(key);52 }54 }