Java optimization and formatting fixes (#4857)

This commit is contained in:
Sriman Achanta
2022-12-26 14:37:53 -05:00
committed by GitHub
parent 92149efa11
commit 26bdbf3d41
13 changed files with 21 additions and 35 deletions

View File

@@ -4,6 +4,8 @@
package edu.wpi.first.util;
import java.util.Arrays;
/** This is a simple circular buffer so we don't need to "bucket brigade" copy old values. */
public class CircularBuffer {
private double[] m_data;
@@ -21,9 +23,7 @@ public class CircularBuffer {
*/
public CircularBuffer(int size) {
m_data = new double[size];
for (int i = 0; i < m_data.length; i++) {
m_data[i] = 0.0;
}
Arrays.fill(m_data, 0.0);
}
/**
@@ -150,9 +150,7 @@ public class CircularBuffer {
/** Sets internal buffer contents to zero. */
public void clear() {
for (int i = 0; i < m_data.length; i++) {
m_data[i] = 0.0;
}
Arrays.fill(m_data, 0.0);
m_front = 0;
m_length = 0;
}