-
Notifications
You must be signed in to change notification settings - Fork 0
/
NodeCache.java
executable file
·56 lines (48 loc) · 1.48 KB
/
NodeCache.java
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
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
import sign.signlink;
final class NodeCache {
public NodeCache()
{
int i = 1024;//was parameter
size = i;
cache = new Node[i];
for(int k = 0; k < i; k++)
{
Node node = cache[k] = new Node();
node.prev = node;
node.next = node;
}
}
public Node findNodeByID(long l)
{
Node node = cache[(int)(l & (long)(size - 1))];
for(Node node_1 = node.prev; node_1 != node; node_1 = node_1.prev)
if(node_1.id == l)
return node_1;
return null;
}
public void removeFromCache(Node node, long l)
{
try
{
if(node.next != null)
node.unlink();
Node node_1 = cache[(int)(l & (long)(size - 1))];
node.next = node_1.next;
node.prev = node_1;
node.next.prev = node;
node.prev.next = node;
node.id = l;
return;
}
catch(RuntimeException runtimeexception)
{
signlink.reporterror("91499, " + node + ", " + l + ", " + (byte)7 + ", " + runtimeexception.toString());
}
throw new RuntimeException();
}
private final int size;
private final Node[] cache;
}