diff --git a/src/main/java/io/github/arrayv/utils/ArrayVList.java b/src/main/java/io/github/arrayv/utils/ArrayVList.java index a9fd7a02..fa9f2553 100644 --- a/src/main/java/io/github/arrayv/utils/ArrayVList.java +++ b/src/main/java/io/github/arrayv/utils/ArrayVList.java @@ -1,12 +1,12 @@ package io.github.arrayv.utils; +import java.awt.Color; // i beg of you stop rejecting this import + import io.github.arrayv.main.ArrayVisualizer; import java.util.*; import java.util.function.Consumer; -import java.awt.Color; - public class ArrayVList extends AbstractList implements RandomAccess, java.io.Serializable { private static final int DEFAULT_CAPACITY = 128; private static final double DEFAULT_GROW_FACTOR = 2; diff --git a/src/main/java/io/github/arrayv/utils/Highlights.java b/src/main/java/io/github/arrayv/utils/Highlights.java index 17f9bea5..b62f9169 100644 --- a/src/main/java/io/github/arrayv/utils/Highlights.java +++ b/src/main/java/io/github/arrayv/utils/Highlights.java @@ -48,7 +48,7 @@ public final class Highlights { private volatile boolean retainColorMarks = false; private volatile Map defined; - private static int[] main; + private final int[] main; private volatile int maxHighlightMarked; // IMPORTANT: This stores the index one past the farthest highlight used, so that a value // of 0 means no highlights are in use, and iteration is more convenient. @@ -94,10 +94,10 @@ public Highlights(ArrayVisualizer arrayVisualizer, int maximumLength) { this.maxHighlightMarked = 0; this.markCount = new AtomicInteger(); - main = arrayVisualizer.getArray(); // Colorcoding shorthand thing - Arrays.fill(highlights, -1); Arrays.fill(markCounts, (byte)0); + + this.main = arrayVisualizer.getArray(); // I refuse to remove this line of code without putting up a fight this.registerColorMarks(main); } @@ -299,7 +299,7 @@ public synchronized void clearColor(int[] array, int position) { } public synchronized void clearColor(int position) { - clearColor(main, position); + clearColor(this.main, position); } public synchronized boolean hasColor(int[] array, int position) {