From: Peter Bernard West Date: Wed, 25 Feb 2004 22:33:54 +0000 (+0000) Subject: Added makePageId method. X-Git-Tag: Alt-Design_pre_awt_renderer_import~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e9f24735c6cdb3d26dffc6811eb17b6b32e7d0c0;p=xmlgraphics-fop.git Added makePageId method. Cleaned up Javadoc link to inaccessible method. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197374 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/pagination/FoLayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/FoLayoutMasterSet.java index bd58976d3..776591c54 100644 --- a/src/java/org/apache/fop/fo/pagination/FoLayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/FoLayoutMasterSet.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.NoSuchElementException; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.Fop; import org.apache.fop.datastructs.TreeException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOTree; @@ -51,8 +52,7 @@ public class FoLayoutMasterSet extends FONode { /** Map of Integer indices of sparsePropsSet array. It is indexed by the FO index of the FO associated with a given - position in the sparsePropsSet array. See - {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}. + position in the sparsePropsSet array. */ private static final int[] sparsePropsMap; @@ -240,5 +240,25 @@ public class FoLayoutMasterSet extends FONode { public Map getPageSequenceMasters() { return finalPageSequenceMasters; } - + + /** + * The genrator field for page ids. + * These page ids generated within any given instance of + * FoLayoutMasterSet increase monotonically from 1 through + * the range of values of long. They wrap around when that + * range is exhausted, but the value 0 is never returned. + */ + private long pageId = 0; + + /** + * @return a long page id not equal to 0. + */ + public long makePageId() { + if (++pageId == 0) { + ++pageId; // 0 is invalid + Fop.logger.warning("Page ID rollover."); + } + return pageId; + } + }// FoLayoutMasterSet