From 05e65034a45947b711202f459a58a4200c3dbeb9 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Fri, 16 Jan 2004 15:24:25 +0000 Subject: [PATCH] Added boolean isExhausted to allow SyncedXmlEventsBuffer (which extends SyncedCircularBuffer) to implement the interface XmlEventSource. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197201 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/datastructs/SyncedCircularBuffer.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/java/org/apache/fop/datastructs/SyncedCircularBuffer.java b/src/java/org/apache/fop/datastructs/SyncedCircularBuffer.java index d1ee5e400..370af72ac 100644 --- a/src/java/org/apache/fop/datastructs/SyncedCircularBuffer.java +++ b/src/java/org/apache/fop/datastructs/SyncedCircularBuffer.java @@ -1,10 +1,4 @@ /* - * SyncedCircularBuffer.java - * $Id$ - * - * Created: Tue Nov 6 10:19:03 2001 - * - * * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -53,8 +47,8 @@ * Software Foundation, please see . * * - * @author Peter B. West - * @version $Revision$ $Name$ + * $Id$ + * Created: Tue Nov 6 10:19:03 2001 */ package org.apache.fop.datastructs; @@ -70,6 +64,9 @@ import java.lang.IndexOutOfBoundsException; * Warning: if the producer or consumer thread dies unexpectedly, * without interrupting the complementary thread's wait(), that * process will hang on the wait(). + * + * @author Peter B. West + * @version $Revision$ $Name$ */ public class SyncedCircularBuffer { @@ -234,7 +231,8 @@ public class SyncedCircularBuffer { /** * Notifies the consumer that the producer has terminated. - * The notifyAll() call allows for processing of the buffer before it fills. + * The notifyAll() call allows for processing of the buffer before + * it fills. */ public void producerExhausted() { synchronized (this) { @@ -245,5 +243,14 @@ public class SyncedCircularBuffer { } } } + + /** + * Is this source of XmlEvents exhausted? + * @return true if the last event from the input stream (END_DOCUMENT) + * has been processed, and the buffer is empty. + */ + public boolean isExhausted() { + return producerFinished && isEmpty(); + } } -- 2.39.5