| 1 | package CtCILibrary; |
| 2 | |
| 3 | public class LinkedListNode { |
| 4 | public LinkedListNode next; |
| 5 | public LinkedListNode prev; |
| 6 | public LinkedListNode last; |
| 7 | public int data; |
| 8 | public LinkedListNode(int d, LinkedListNode n, LinkedListNode p) { |
| 9 | data = d; |
| 10 | setNext(n); |
| 11 | setPrevious(p); |
| 12 | } |
| 13 | |
| 14 | public LinkedListNode() { } |
| 15 | |
| 16 | public void setNext(LinkedListNode n) { |
| 17 | next = n; |
| 18 | if (this == last) { |
| 19 | last = n; |
| 20 | } |
| 21 | if (n != null && n.prev != this) { |
| 22 | n.setPrevious(this); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | public void setPrevious(LinkedListNode p) { |
| 27 | prev = p; |
| 28 | if (p != null && p.next != this) { |
| 29 | p.setNext(this); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | public String printForward() { |
| 34 | if (next != null) { |
| 35 | return data + "->" + next.printForward(); |
| 36 | } else { |
| 37 | return ((Integer) data).toString(); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | public LinkedListNode clone() { |
| 42 | LinkedListNode next2 = null; |
| 43 | if (next != null) { |
| 44 | next2 = next.clone(); |
| 45 | } |
| 46 | LinkedListNode head2 = new LinkedListNode(data, next2, null); |
| 47 | return head2; |
| 48 | } |
| 49 | } |
nothing calls this directly
no outgoing calls
no test coverage detected