Code cleanup (#4246)

This commit is contained in:
HManiac74
2023-07-22 17:23:00 +02:00
committed by GitHub
parent 3facb0d862
commit 2488a2ad51
52 changed files with 50 additions and 167 deletions

View File

@ -43,7 +43,6 @@ public class NodeStack<Item> {
private Item data;
private static NodeStack<?> head;
private NodeStack<?> next;
private NodeStack<?> previous;
private static int size = 0;
@ -72,7 +71,7 @@ public class NodeStack<Item> {
} else {
newNs.setPrevious(NodeStack.head);
NodeStack.head.setNext(newNs);
NodeStack.head.setHead(newNs);
NodeStack.setHead(newNs);
}
NodeStack.setSize(NodeStack.getSize() + 1);
@ -86,7 +85,7 @@ public class NodeStack<Item> {
public Item pop() {
Item item = (Item) NodeStack.head.getData();
NodeStack.head.setHead(NodeStack.head.getPrevious());
NodeStack.setHead(NodeStack.head.getPrevious());
NodeStack.head.setNext(null);
NodeStack.setSize(NodeStack.getSize() - 1);
@ -133,23 +132,11 @@ public class NodeStack<Item> {
}
}
/**
* Getters and setters (private)
*/
private NodeStack<?> getHead() {
return NodeStack.head;
}
private static void setHead(NodeStack<?> ns) {
NodeStack.head = ns;
}
private NodeStack<?> getNext() {
return next;
}
private void setNext(NodeStack<?> next) {
this.next = next;
}
private NodeStack<?> getPrevious() {
@ -171,8 +158,4 @@ public class NodeStack<Item> {
private Item getData() {
return this.data;
}
private void setData(Item item) {
this.data = item;
}
}