/** * Write the buffer out using a custom routine. * * @param out the output stream * @throws IOException */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (Iterator it = iterator(); it.hasNext();) { out.writeObject(it.next()); } }
/** * Write the buffer out using a custom routine. * * @param out the output stream * @throws IOException */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (Iterator it = iterator(); it.hasNext();) { out.writeObject(it.next()); } }
public void testInternalStateIteratorRemove2() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(4); test.add("A"); test.add("B"); test.add("C"); Iterator it = test.iterator(); it.next(); it.next(); it.remove(); assertEquals(5, test.buffer.length); assertEquals(0, test.head); assertEquals(2, test.tail); test.add("D"); assertEquals(5, test.buffer.length); assertEquals(0, test.head); assertEquals(3, test.tail); }
public void testInternalStateIteratorRemoveWithTailAtEnd3() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(3); test.add("A"); test.add("B"); test.add("C"); test.remove("A"); test.add("D"); assertEquals(4, test.buffer.length); assertEquals(1, test.head); assertEquals(0, test.tail); Iterator it = test.iterator(); assertEquals("B", it.next()); assertEquals("C", it.next()); assertEquals("D", it.next()); it.remove(); assertEquals(4, test.buffer.length); assertEquals(1, test.head); assertEquals(3, test.tail); }
public void testInternalStateIteratorRemoveWithTailAtEnd2() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(3); test.add("A"); test.add("B"); test.add("C"); test.remove("A"); test.add("D"); assertEquals(4, test.buffer.length); assertEquals(1, test.head); assertEquals(0, test.tail); Iterator it = test.iterator(); assertEquals("B", it.next()); assertEquals("C", it.next()); it.remove(); assertEquals(4, test.buffer.length); assertEquals(1, test.head); assertEquals(3, test.tail); }
public void testInternalStateIteratorRemoveWithWrap3() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(3); test.add("A"); test.add("B"); test.add("C"); test.remove("A"); test.remove("B"); test.add("D"); test.add("E"); assertEquals(4, test.buffer.length); assertEquals(2, test.head); assertEquals(1, test.tail); Iterator it = test.iterator(); assertEquals("C", it.next()); assertEquals("D", it.next()); assertEquals("E", it.next()); it.remove(); assertEquals(4, test.buffer.length); assertEquals(2, test.head); assertEquals(0, test.tail); }
public void testInternalStateIteratorRemoveWithTailAtEnd1() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(3); test.add("A"); test.add("B"); test.add("C"); test.remove("A"); test.add("D"); assertEquals(4, test.buffer.length); assertEquals(1, test.head); assertEquals(0, test.tail); Iterator it = test.iterator(); assertEquals("B", it.next()); it.remove(); assertEquals(4, test.buffer.length); assertEquals(2, test.head); assertEquals(0, test.tail); }
public void testInternalStateIteratorRemove1() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(4); test.add("A"); test.add("B"); test.add("C"); assertEquals(5, test.buffer.length); assertEquals(0, test.head); assertEquals(3, test.tail); Iterator it = test.iterator(); it.next(); it.remove(); assertEquals(5, test.buffer.length); assertEquals(1, test.head); assertEquals(3, test.tail); test.add("D"); assertEquals(5, test.buffer.length); assertEquals(1, test.head); assertEquals(4, test.tail); }
public void testInternalStateIteratorRemoveWithWrap2() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(3); test.add("A"); test.add("B"); test.add("C"); test.remove("A"); test.remove("B"); test.add("D"); test.add("E"); assertEquals(4, test.buffer.length); assertEquals(2, test.head); assertEquals(1, test.tail); Iterator it = test.iterator(); assertEquals("C", it.next()); assertEquals("D", it.next()); it.remove(); assertEquals(4, test.buffer.length); assertEquals(2, test.head); assertEquals(0, test.tail); }
public void testInternalStateIteratorRemoveWithWrap1() { UnboundedFifoBuffer test = new UnboundedFifoBuffer(3); test.add("A"); test.add("B"); test.add("C"); test.remove("A"); test.remove("B"); test.add("D"); test.add("E"); assertEquals(4, test.buffer.length); assertEquals(2, test.head); assertEquals(1, test.tail); Iterator it = test.iterator(); assertEquals("C", it.next()); it.remove(); assertEquals(4, test.buffer.length); assertEquals(3, test.head); assertEquals(1, test.tail); }
/** * Write the buffer out using a custom routine. * * @param out the output stream * @throws IOException */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (Iterator it = iterator(); it.hasNext();) { out.writeObject(it.next()); } }
/** * Write the buffer out using a custom routine. * * @param out the output stream * @throws IOException */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (Iterator it = iterator(); it.hasNext();) { out.writeObject(it.next()); } }
/** * Write the buffer out using a custom routine. * * @param out the output stream * @throws IOException */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (Iterator it = iterator(); it.hasNext();) { out.writeObject(it.next()); } }
/** * Write the buffer out using a custom routine. * * @param out the output stream * @throws IOException */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (Iterator it = iterator(); it.hasNext();) { out.writeObject(it.next()); } }
/** * Write the buffer out using a custom routine. * * @param out the output stream * @throws IOException */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (Iterator it = iterator(); it.hasNext();) { out.writeObject(it.next()); } }