-
Notifications
You must be signed in to change notification settings - Fork 0
/
NodeSubList.java
executable file
·76 lines (67 loc) · 1.74 KB
/
NodeSubList.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
final class NodeSubList {
public NodeSubList()
{
head = new NodeSub();
head.prevNodeSub = head;
head.nextNodeSub = head;
}
public void insertHead(NodeSub nodeSub)
{
if(nodeSub.nextNodeSub != null)
nodeSub.unlinkSub();
nodeSub.nextNodeSub = head.nextNodeSub;
nodeSub.prevNodeSub = head;
nodeSub.nextNodeSub.prevNodeSub = nodeSub;
nodeSub.prevNodeSub.nextNodeSub = nodeSub;
}
public NodeSub popTail()
{
NodeSub nodeSub = head.prevNodeSub;
if(nodeSub == head)
{
return null;
} else
{
nodeSub.unlinkSub();
return nodeSub;
}
}
public NodeSub reverseGetFirst()
{
NodeSub nodeSub = head.prevNodeSub;
if(nodeSub == head)
{
current = null;
return null;
} else
{
current = nodeSub.prevNodeSub;
return nodeSub;
}
}
public NodeSub reverseGetNext()
{
NodeSub nodeSub = current;
if(nodeSub == head)
{
current = null;
return null;
} else
{
current = nodeSub.prevNodeSub;
return nodeSub;
}
}
public int getNodeCount()
{
int i = 0;
for(NodeSub nodeSub = head.prevNodeSub; nodeSub != head; nodeSub = nodeSub.prevNodeSub)
i++;
return i;
}
private final NodeSub head;
private NodeSub current;
}