-
Notifications
You must be signed in to change notification settings - Fork 341
Expand file tree
/
Copy pathName1.java
More file actions
41 lines (34 loc) · 1004 Bytes
/
Name1.java
File metadata and controls
41 lines (34 loc) · 1004 Bytes
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
package org.codehaus.jackson.sym;
/**
* Specialized implementation of PName: can be used for short Strings
* that consists of at most 4 bytes. Usually this means short
* ascii-only names.
*<p>
* The reason for such specialized classes is mostly space efficiency;
* and to a lesser degree performance. Both are achieved for short
* Strings by avoiding another level of indirection (via quad arrays)
*/
public final class Name1
extends Name
{
final static Name1 sEmptyName = new Name1("", 0, 0);
final int mQuad;
Name1(String name, int hash, int quad)
{
super(name, hash);
mQuad = quad;
}
final static Name1 getEmptyName() { return sEmptyName; }
public boolean equals(int quad)
{
return (quad == mQuad);
}
public boolean equals(int quad1, int quad2)
{
return (quad1 == mQuad) && (quad2 == 0);
}
public boolean equals(int[] quads, int qlen)
{
return (qlen == 1 && quads[0] == mQuad);
}
}