MCPcopy Index your code
hub / github.com/clojure/clojure / ReaderConditional

Class ReaderConditional

src/jvm/clojure/lang/ReaderConditional.java:13–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11package clojure.lang;
12
13public class ReaderConditional implements ILookup {
14
15public static final Keyword FORM_KW = Keyword.intern("form");
16public static final Keyword SPLICING_KW = Keyword.intern("splicing?");
17
18public final Object form;
19public final Boolean splicing;
20
21public static ReaderConditional create(Object form, boolean splicing) {
22 return new ReaderConditional(form, splicing);
23}
24
25private ReaderConditional(Object form, boolean splicing){
26 this.form = form;
27 this.splicing = splicing;
28}
29
30
31public Object valAt(Object key) {
32 return valAt(key, null);
33}
34
35public Object valAt(Object key, Object notFound) {
36 if (FORM_KW.equals(key)) {
37 return this.form;
38 } else if (SPLICING_KW.equals(key)) {
39 return this.splicing;
40 } else {
41 return notFound;
42 }
43}
44
45
46@Override
47public boolean equals(Object o) {
48 if (this == o) return true;
49 if (o == null || getClass() != o.getClass()) return false;
50
51 ReaderConditional that = (ReaderConditional) o;
52
53 if (form != null ? !form.equals(that.form) : that.form != null) return false;
54 if (splicing != null ? !splicing.equals(that.splicing) : that.splicing != null)
55 return false;
56 return true;
57}
58
59@Override
60public int hashCode() {
61 int result = Util.hash(form);
62 result = 31 * result + Util.hash(splicing);
63 return result;
64}
65
66}

Callers

nothing calls this directly

Calls 1

internMethod · 0.95

Tested by

no test coverage detected