FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
clojure/src/jvm/clojure/lang/Keyword.java at master · clojure/clojure · GitHub
clojure
/
clojure
Public
Notifications
You must be signed in to change notification settings
Fork
1.5k
Star
11k
Code
Actions
Projects
Security and quality
1
Insights
Additional navigation options
Code
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
clojure
/
src
/
jvm
/
clojure
/
lang
/
Keyword.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
267 lines (215 loc) · 8.14 KB
Breadcrumbs
clojure
/
src
/
jvm
/
clojure
/
lang
/
Keyword.java
Copy path
File metadata and controls
267 lines (215 loc) · 8.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/**
* 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.
**/
/* rich Mar 29, 2006 10:39:05 AM */
package
clojure
.
lang
;
import
java
.
io
.
ObjectStreamException
;
import
java
.
io
.
Serializable
;
import
java
.
lang
.
ref
.
Reference
;
import
java
.
lang
.
ref
.
WeakReference
;
import
java
.
util
.
concurrent
.
ConcurrentHashMap
;
import
java
.
lang
.
ref
.
ReferenceQueue
;
import
java
.
lang
.
ref
.
SoftReference
;
public
class
Keyword
implements
IFn
,
Comparable
,
Named
,
Serializable
,
IHashEq
{
private
static
final
long
serialVersionUID
= -
2105088845257724163L
;
private
static
ConcurrentHashMap
<
Symbol
,
Reference
<
Keyword
>>
table
=
new
ConcurrentHashMap
();
static
final
ReferenceQueue
rq
=
new
ReferenceQueue
();
public
final
Symbol
sym
;
final
int
hasheq
;
transient
String
_str
;
public
static
Keyword
intern
(
Symbol
sym
){
Keyword
k
=
null
;
Reference
<
Keyword
>
existingRef
=
table
.
get
(
sym
);
if
(
existingRef
==
null
)
{
Util
.
clearCache
(
rq
,
table
);
if
(
sym
.
meta
() !=
null
)
sym
= (
Symbol
)
sym
.
withMeta
(
null
);
k
=
new
Keyword
(
sym
);
existingRef
=
table
.
putIfAbsent
(
sym
,
new
WeakReference
<
Keyword
>(
k
,
rq
));
}
if
(
existingRef
==
null
)
return
k
;
Keyword
existingk
=
existingRef
.
get
();
if
(
existingk
!=
null
)
return
existingk
;
//entry died in the interim, do over
table
.
remove
(
sym
,
existingRef
);
return
intern
(
sym
);
}
public
static
Keyword
intern
(
String
ns
,
String
name
){
return
intern
(
Symbol
.
intern
(
ns
,
name
));
}
public
static
Keyword
intern
(
String
nsname
){
return
intern
(
Symbol
.
intern
(
nsname
));
}
private
Keyword
(
Symbol
sym
){
this
.
sym
=
sym
;
hasheq
=
sym
.
hasheq
() +
0x9e3779b9
;
}
public
static
Keyword
find
(
Symbol
sym
){
Reference
<
Keyword
>
ref
=
table
.
get
(
sym
);
if
(
ref
!=
null
)
return
ref
.
get
();
else
return
null
;
}
public
static
Keyword
find
(
String
ns
,
String
name
){
return
find
(
Symbol
.
intern
(
ns
,
name
));
}
public
static
Keyword
find
(
String
nsname
){
return
find
(
Symbol
.
intern
(
nsname
));
}
public
final
int
hashCode
(){
return
sym
.
hashCode
() +
0x9e3779b9
;
}
public
int
hasheq
() {
return
hasheq
;
}
public
String
toString
(){
if
(
_str
==
null
)
_str
= (
":"
+
sym
);
return
_str
;
}
/**
* @deprecated CLJ-2350: This function is no longer called, but has not been
* removed to maintain the public interface.
*/
public
Object
throwArity
(){
throw
new
IllegalArgumentException
(
"Wrong number of args passed to keyword: "
+
toString
());
}
Object
throwArity
(
int
n
) {
throw
new
ArityException
(
n
,
toString
());
}
public
Object
call
() {
return
throwArity
(
0
);
}
public
void
run
(){
throw
new
UnsupportedOperationException
();
}
public
Object
invoke
() {
return
throwArity
(
0
);
}
public
int
compareTo
(
Object
o
){
return
sym
.
compareTo
(((
Keyword
)
o
).
sym
);
}
public
String
getNamespace
(){
return
sym
.
getNamespace
();
}
public
String
getName
(){
return
sym
.
getName
();
}
private
Object
readResolve
()
throws
ObjectStreamException
{
return
intern
(
sym
);
}
/**
* Indexer implements IFn for attr access
*
* @param obj - must be IPersistentMap
* @return the value at the key or nil if not found
*/
final
public
Object
invoke
(
Object
obj
) {
if
(
obj
instanceof
ILookup
)
return
((
ILookup
)
obj
).
valAt
(
this
);
return
RT
.
get
(
obj
,
this
);
}
final
public
Object
invoke
(
Object
obj
,
Object
notFound
) {
if
(
obj
instanceof
ILookup
)
return
((
ILookup
)
obj
).
valAt
(
this
,
notFound
);
return
RT
.
get
(
obj
,
this
,
notFound
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
) {
return
throwArity
(
3
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
,
Object
arg4
) {
return
throwArity
(
4
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
,
Object
arg4
,
Object
arg5
) {
return
throwArity
(
5
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
,
Object
arg4
,
Object
arg5
,
Object
arg6
) {
return
throwArity
(
6
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
,
Object
arg4
,
Object
arg5
,
Object
arg6
,
Object
arg7
)
{
return
throwArity
(
7
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
,
Object
arg4
,
Object
arg5
,
Object
arg6
,
Object
arg7
,
Object
arg8
) {
return
throwArity
(
8
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
,
Object
arg4
,
Object
arg5
,
Object
arg6
,
Object
arg7
,
Object
arg8
,
Object
arg9
) {
return
throwArity
(
9
);
}
public
Object
invoke
(
Object
arg1
,
Object
arg2
,
Object
arg3
,
Object
arg4
,
Object
arg5
,
Object
arg6
,
Object
arg7
,
Object
arg8
,
Object
arg9
,
Object
arg10
) {
return
throwArity
(
10
);
}
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
) {
return
throwArity
(
11
);
}
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
) {
return
throwArity
(
12
);
}
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
)
{
return
throwArity
(
13
);
}
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
)
{
return
throwArity
(
14
);
}
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
) {
return
throwArity
(
15
);
}
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
) {
return
throwArity
(
16
);
}
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
) {
return
throwArity
(
17
);
}
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
) {
return
throwArity
(
18
);
}
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
) {
return
throwArity
(
19
);
}
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
)
{
return
throwArity
(
20
);
}
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
)
{
return
throwArity
(
20
+
args
.
length
);
}
public
Object
applyTo
(
ISeq
arglist
) {
return
AFn
.
applyToHelper
(
this
,
arglist
);
}
}
Back
|
FazBrowse Home
|
New Git URL