|
Java example source code file (ReaderConditional.java)
The ReaderConditional.java Java example source code/** * Copyright (c) Rich Hickey. All rights reserved. * The use and distribution terms for this software are covered by the * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) * which can be found in the file epl-v10.html 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 ReaderConditional implements ILookup { public static final Keyword FORM_KW = Keyword.intern("form"); public static final Keyword SPLICING_KW = Keyword.intern("splicing?"); public final Object form; public final Boolean splicing; public static ReaderConditional create(Object form, boolean splicing) { return new ReaderConditional(form, splicing); } private ReaderConditional(Object form, boolean splicing){ this.form = form; this.splicing = splicing; } public Object valAt(Object key) { return valAt(key, null); } public Object valAt(Object key, Object notFound) { if (FORM_KW.equals(key)) { return this.form; } else if (SPLICING_KW.equals(key)) { return this.splicing; } else { return notFound; } } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ReaderConditional that = (ReaderConditional) o; if (form != null ? !form.equals(that.form) : that.form != null) return false; if (splicing != null ? !splicing.equals(that.splicing) : that.splicing != null) return false; return true; } @Override public int hashCode() { int result = Util.hash(form); result = 31 * result + Util.hash(splicing); return result; } } Other Java examples (source code examples)Here is a short list of links related to this Java ReaderConditional.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.