@Test public void add4() { CircularBufferDouble coll = new CircularBufferDouble(3); for (int i = 0; i < 5; i++) { coll.addDouble(i); } ListDouble reference = new ArrayDouble(new double[] {2,3,4}); assertThat(coll, equalTo(reference)); }
public void addDouble(double value) { data[endOffset] = value; endOffset++; if (endOffset == data.length && !reachedMax) resize(); if (endOffset == data.length) { endOffset = 0; } if (endOffset == startOffset) startOffset++; if (startOffset == data.length) startOffset = 0; }
CircularBufferDouble extends ListDouble { public void addDouble(double value) { data[endOffset] = value; endOffset++; if (endOffset == data.length && !reachedMax) resize(); if (endOffset == data.length) { endOffset = 0; } if (endOffset == startOffset) startOffset++; if (startOffset == data.length) startOffset = 0; } }
CircularBufferDouble extends ListDouble { public void addDouble(double value) { data[endOffset] = value; endOffset++; if (endOffset == data.length && !reachedMax) resize(); if (endOffset == data.length) { endOffset = 0; } if (endOffset == startOffset) startOffset++; if (startOffset == data.length) startOffset = 0; } CircularBufferDouble(int maxCapacity);  CircularBufferDouble(int initialCapacity, int maxCapacity); }
CircularBufferDouble extends ListDouble { public void addDouble(double value) { data[endOffset] = value; endOffset++; if (endOffset == data.length && !reachedMax) resize(); if (endOffset == data.length) { endOffset = 0; } if (endOffset == startOffset) startOffset++; if (startOffset == data.length) startOffset = 0; } CircularBufferDouble(int maxCapacity);  CircularBufferDouble(int initialCapacity, int maxCapacity); @Override double getDouble(int index); @Override int size(); void addDouble(double value); void clear(); int getCurrentCapacity(); }
CircularBufferDouble extends ListDouble { public void addDouble(double value) { data[endOffset] = value; endOffset++; if (endOffset == data.length && !reachedMax) resize(); if (endOffset == data.length) { endOffset = 0; } if (endOffset == startOffset) startOffset++; if (startOffset == data.length) startOffset = 0; } CircularBufferDouble(int maxCapacity);  CircularBufferDouble(int initialCapacity, int maxCapacity); @Override double getDouble(int index); @Override int size(); void addDouble(double value); void clear(); int getCurrentCapacity();  }