[wpiutil] CircularBuffer: Change Java package-private methods to public (#4181)

The `size`, `getFirst`, `getLast`, and `resize` methods were all package-private.

Also make `size` return an `int` instead of a `double`.
This commit is contained in:
ysthakur
2022-04-25 17:58:12 -04:00
committed by GitHub
parent fbe761f7f6
commit 51bc893bc5

View File

@@ -31,7 +31,7 @@ public class CircularBuffer {
*
* @return number of elements in buffer
*/
double size() {
public int size() {
return m_length;
}
@@ -40,7 +40,7 @@ public class CircularBuffer {
*
* @return value at front of buffer
*/
double getFirst() {
public double getFirst() {
return m_data[m_front];
}
@@ -49,7 +49,7 @@ public class CircularBuffer {
*
* @return value at back of buffer
*/
double getLast() {
public double getLast() {
// If there are no elements in the buffer, do nothing
if (m_length == 0) {
return 0.0;
@@ -138,7 +138,7 @@ public class CircularBuffer {
*
* @param size New buffer size.
*/
void resize(int size) {
public void resize(int size) {
double[] newBuffer = new double[size];
m_length = Math.min(m_length, size);
for (int i = 0; i < m_length; i++) {