mirror of
https://bitbucket.org/projectswg/lightspeed.git
synced 2026-09-28 14:12:57 -04:00
Completely overhauled how the GUI operates and key parts of the backend
This commit is contained in:
@@ -32,7 +32,7 @@ import java.util.ConcurrentModificationException;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Queue;
|
||||
|
||||
class IntentQueue implements Queue<Intent> {
|
||||
class IntentQueue<E> implements Queue<E> {
|
||||
|
||||
private final Node head;
|
||||
private int size;
|
||||
@@ -59,7 +59,7 @@ class IntentQueue implements Queue<Intent> {
|
||||
public boolean contains(Object o) {
|
||||
Node n = head;
|
||||
while (n.left != head) {
|
||||
if (n.left.intent == o)
|
||||
if (n.left.value == o)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -85,7 +85,7 @@ class IntentQueue implements Queue<Intent> {
|
||||
modificationCount++;
|
||||
Node n = head;
|
||||
while (n.left != head) {
|
||||
if (n.left.intent == o) {
|
||||
if (n.left.value == o) {
|
||||
n.left = n.left.left;
|
||||
n.left.right = n;
|
||||
}
|
||||
@@ -102,9 +102,9 @@ class IntentQueue implements Queue<Intent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends Intent> c) {
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
boolean added = false;
|
||||
for (Intent i : c)
|
||||
for (E i : c)
|
||||
added = add(i) || added;
|
||||
return added;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class IntentQueue implements Queue<Intent> {
|
||||
boolean changed = false;
|
||||
Node n = head;
|
||||
while (n.left != head) {
|
||||
if (!c.contains(n.left.intent)) {
|
||||
if (!c.contains(n.left.value)) {
|
||||
n.left.left.right = n;
|
||||
n.left = n.left.left;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class IntentQueue implements Queue<Intent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Intent e) {
|
||||
public boolean add(E e) {
|
||||
head.right.left = new Node(e, head, head.right);
|
||||
head.right = head.right.left;
|
||||
modificationCount++;
|
||||
@@ -148,16 +148,16 @@ class IntentQueue implements Queue<Intent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean offer(Intent e) {
|
||||
public boolean offer(E e) {
|
||||
return add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent remove() {
|
||||
public E remove() {
|
||||
if (isEmpty())
|
||||
throw new NoSuchElementException("Queue is empty!");
|
||||
modificationCount++;
|
||||
Intent i = head.left.intent;
|
||||
E i = head.left.value;
|
||||
head.left = head.left.left;
|
||||
head.left.right = head;
|
||||
size--;
|
||||
@@ -165,11 +165,11 @@ class IntentQueue implements Queue<Intent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent poll() {
|
||||
public E poll() {
|
||||
if (isEmpty())
|
||||
return null;
|
||||
modificationCount++;
|
||||
Intent i = head.left.intent;
|
||||
E i = head.left.value;
|
||||
head.left = head.left.left;
|
||||
head.left.right = head;
|
||||
size--;
|
||||
@@ -177,20 +177,20 @@ class IntentQueue implements Queue<Intent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent element() {
|
||||
public E element() {
|
||||
if (isEmpty())
|
||||
throw new NoSuchElementException("Queue is empty!");
|
||||
return head.left.intent;
|
||||
return head.left.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent peek() {
|
||||
public E peek() {
|
||||
if (isEmpty())
|
||||
return null;
|
||||
return head.left.intent;
|
||||
return head.left.value;
|
||||
}
|
||||
|
||||
private class Iterator implements java.util.Iterator<Intent> {
|
||||
private class Iterator implements java.util.Iterator<E> {
|
||||
|
||||
private final int modificationCount;
|
||||
private Node currentNode;
|
||||
@@ -208,24 +208,24 @@ class IntentQueue implements Queue<Intent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent next() {
|
||||
public E next() {
|
||||
if (!hasNext())
|
||||
throw new NoSuchElementException("Iterator has reached the end of the queue!");
|
||||
Intent i = currentNode.left.intent;
|
||||
E i = currentNode.left.value;
|
||||
currentNode = currentNode.left;
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Node {
|
||||
private class Node {
|
||||
|
||||
public final Intent intent;
|
||||
public final E value;
|
||||
public Node left;
|
||||
public Node right;
|
||||
|
||||
public Node(Intent intent, Node left, Node right) {
|
||||
this.intent = intent;
|
||||
public Node(E value, Node left, Node right) {
|
||||
this.value = value;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user