BoundedFifoBuffer.this.remove(); lastReturnedIndex = -1; return;
BoundedFifoBuffer.this.remove(); lastReturnedIndex = -1; return;
/** * Tests that the removal operation actually removes the first element. */ public void testBoundedFifoBufferRemove() { resetFull(); int size = confirmed.size(); for (int i = 0; i < size; i++) { Object o1 = ((BoundedFifoBuffer)collection).remove(); Object o2 = ((ArrayList)confirmed).remove(0); assertEquals("Removed objects should be equal", o1, o2); verify(); } try { ((BoundedFifoBuffer)collection).remove(); fail("Empty buffer should raise Underflow."); } catch (BufferUnderflowException e) { // expected } }
/** * Tests is full */ public void testIsFull() { resetFull(); assertEquals(true, ((BoundedCollection) collection).isFull()); ((BoundedFifoBuffer) collection).remove(); assertEquals(false, ((BoundedCollection) collection).isFull()); ((BoundedFifoBuffer) collection).add("jj"); assertEquals(true, ((BoundedCollection) collection).isFull()); }
public void testIsFull() { Set set = new HashSet(); set.add("1"); set.add("2"); set.add("3"); try { CollectionUtils.isFull(null); fail(); } catch (NullPointerException ex) {} assertEquals(false, CollectionUtils.isFull(set)); BoundedFifoBuffer buf = new BoundedFifoBuffer(set); assertEquals(true, CollectionUtils.isFull(buf)); buf.remove("2"); assertEquals(false, CollectionUtils.isFull(buf)); buf.add("2"); assertEquals(true, CollectionUtils.isFull(buf)); Buffer buf2 = BufferUtils.synchronizedBuffer(buf); assertEquals(true, CollectionUtils.isFull(buf2)); buf2.remove("2"); assertEquals(false, CollectionUtils.isFull(buf2)); buf2.add("2"); assertEquals(true, CollectionUtils.isFull(buf2)); }
public void testMaxSize() { Set set = new HashSet(); set.add("1"); set.add("2"); set.add("3"); try { CollectionUtils.maxSize(null); fail(); } catch (NullPointerException ex) {} assertEquals(-1, CollectionUtils.maxSize(set)); BoundedFifoBuffer buf = new BoundedFifoBuffer(set); assertEquals(3, CollectionUtils.maxSize(buf)); buf.remove("2"); assertEquals(3, CollectionUtils.maxSize(buf)); buf.add("2"); assertEquals(3, CollectionUtils.maxSize(buf)); Buffer buf2 = BufferUtils.synchronizedBuffer(buf); assertEquals(3, CollectionUtils.maxSize(buf2)); buf2.remove("2"); assertEquals(3, CollectionUtils.maxSize(buf2)); buf2.add("2"); assertEquals(3, CollectionUtils.maxSize(buf2)); }
/** * Tests max size */ public void testMaxSize() { resetFull(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).remove(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).add("jj"); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); }
BoundedFifoBuffer.this.remove(); lastReturnedIndex = -1; return;
BoundedFifoBuffer.this.remove(); lastReturnedIndex = -1; return;
BoundedFifoBuffer.this.remove(); lastReturnedIndex = -1; return;
BoundedFifoBuffer.this.remove(); lastReturnedIndex = -1; return;
BoundedFifoBuffer.this.remove(); lastReturnedIndex = -1; return;
protected void addProcessed(Object id) { synchronized (processedLock) { if (processed.isFull()) { processed.remove(); } processed.add(id); } }
private void addProcessed(Object id) { synchronized (processedLock) { if (processed.isFull()) { processed.remove(); } processed.add(id); } }
BoundedFifoBuffer apiCallHistory = new BoundedFifoBuffer(20); for(int i =1 ; i < 25; i++){ if(apiCallHistory.isFull()){ System.out.println("removing :: "+apiCallHistory.remove()); } apiCallHistory.add(i); }