MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / main

Method main

src/main/java/net/optifine/util/LinkedListTest.java:10–79  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8public class LinkedListTest
9{
10 public static void main(String[] args) throws Exception
11 {
12 LinkedList<VboRange> linkedlist = new LinkedList();
13 List<VboRange> list = new ArrayList();
14 List<VboRange> list1 = new ArrayList();
15 Random random = new Random();
16 int i = 100;
17
18 for (int j = 0; j < i; ++j)
19 {
20 VboRange vborange = new VboRange();
21 vborange.setPosition(j);
22 list.add(vborange);
23 }
24
25 for (int k = 0; k < 100000; ++k)
26 {
27 checkLists(list, list1, i);
28 checkLinkedList(linkedlist, list1.size());
29
30 if (k % 5 == 0)
31 {
32 dbgLinkedList(linkedlist);
33 }
34
35 if (random.nextBoolean())
36 {
37 if (!list.isEmpty())
38 {
39 VboRange vborange3 = (VboRange)list.get(random.nextInt(list.size()));
40 LinkedList.Node<VboRange> node2 = vborange3.getNode();
41
42 if (random.nextBoolean())
43 {
44 linkedlist.addFirst(node2);
45 dbg("Add first: " + vborange3.getPosition());
46 }
47 else if (random.nextBoolean())
48 {
49 linkedlist.addLast(node2);
50 dbg("Add last: " + vborange3.getPosition());
51 }
52 else
53 {
54 if (list1.isEmpty())
55 {
56 continue;
57 }
58
59 VboRange vborange1 = (VboRange)list1.get(random.nextInt(list1.size()));
60 LinkedList.Node<VboRange> node1 = vborange1.getNode();
61 linkedlist.addAfter(node1, node2);
62 dbg("Add after: " + vborange1.getPosition() + ", " + vborange3.getPosition());
63 }
64
65 list.remove(vborange3);
66 list1.add(vborange3);
67 }

Callers

nothing calls this directly

Calls 15

setPositionMethod · 0.95
checkListsMethod · 0.95
checkLinkedListMethod · 0.95
dbgLinkedListMethod · 0.95
getNodeMethod · 0.95
addFirstMethod · 0.95
dbgMethod · 0.95
getPositionMethod · 0.95
addLastMethod · 0.95
addAfterMethod · 0.95
removeMethod · 0.95
nextIntMethod · 0.80

Tested by

no test coverage detected