Class SheetDataSource
- java.lang.Object
-
- org.daisy.dotify.formatter.impl.sheet.SheetDataSource
-
- All Implemented Interfaces:
SplitPointDataSource<Sheet,SheetDataSource>
public class SheetDataSource extends Object implements SplitPointDataSource<Sheet,SheetDataSource>
Provides a data source forSheets. Given a list ofBlockSequences, sheets are produced one by one.The input is:
- The list of
BlockSequences contained in a volume group or in the pre- or post-content of a volume. A volume group is a set of block sequences starting with a hard volume break (break-before="volume"). - A
PageCounter - The index of the volume group (0-based) or null if the input comes from pre- or post-content.
The computed
VolumeKeepPriorityof a sheet is the priority of the back side page, or the priority of the front side page if that value is higher (lower priority) and if<volume-transition range="sheet"/>.
-
-
Constructor Summary
Constructors Constructor Description SheetDataSource(PageCounter pageCounter, FormatterContext context, DefaultContext rcontext, Integer volumeGroup, List<BlockSequence> seqsIterator)SheetDataSource(SheetDataSource template)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SheetDataSourcecreateEmpty()Creates a new empty data source of the implementing type.Sheetget(int index)Gets the item at index.SheetDataSourcegetDataSource()Gets the data source as is, typically "return this".List<Sheet>getRemaining()Gets all remaining items.intgetSize(int limit)Gets the size of the manager or the limit if the number of items is greater than the limit.Supplements<Sheet>getSupplements()Gets the split point data source supplements.booleanhasElementAt(int index)Returns true if the manager has an element at the specified index.booleanisEmpty()Returns true if the manager contains no items.voidsetCurrentVolumeNumber(int volume)SplitResult<Sheet,SheetDataSource>split(int atIndex)Gets the result of splitting at the specified index.SplitResult<Sheet,SheetDataSource>splitInRange(int atIndex)Gets the result of splitting at the specified index.
-
-
-
Constructor Detail
-
SheetDataSource
public SheetDataSource(PageCounter pageCounter, FormatterContext context, DefaultContext rcontext, Integer volumeGroup, List<BlockSequence> seqsIterator)
-
SheetDataSource
public SheetDataSource(SheetDataSource template)
-
-
Method Detail
-
get
public Sheet get(int index) throws RestartPaginationException
Description copied from interface:SplitPointDataSourceGets the item at index.- Specified by:
getin interfaceSplitPointDataSource<Sheet,SheetDataSource>- Parameters:
index- the index- Returns:
- returns the item
- Throws:
RestartPaginationException
-
getRemaining
public List<Sheet> getRemaining() throws RestartPaginationException
Description copied from interface:SplitPointDataSourceGets all remaining items. Note that using this method will result in all elements being computed, if this is not what is needed. Consider usingSplitPointDataSource.split(int)instead.- Specified by:
getRemainingin interfaceSplitPointDataSource<Sheet,SheetDataSource>- Returns:
- returns all remaining items
- Throws:
RestartPaginationException
-
hasElementAt
public boolean hasElementAt(int index) throws RestartPaginationExceptionDescription copied from interface:SplitPointDataSourceReturns true if the manager has an element at the specified index.- Specified by:
hasElementAtin interfaceSplitPointDataSource<Sheet,SheetDataSource>- Parameters:
index- the index- Returns:
- returns true if the manager has an element at the specified index, false otherwise
- Throws:
RestartPaginationException
-
getSize
public int getSize(int limit) throws RestartPaginationExceptionDescription copied from interface:SplitPointDataSourceGets the size of the manager or the limit if the number of items is greater than the limit.- Specified by:
getSizein interfaceSplitPointDataSource<Sheet,SheetDataSource>- Parameters:
limit- the limit- Returns:
- returns the size, or the limit
- Throws:
RestartPaginationException
-
isEmpty
public boolean isEmpty()
Description copied from interface:SplitPointDataSourceReturns true if the manager contains no items. Note that this method can returns true, even ifSplitPointDataSource.getSupplements()is non-empty.- Specified by:
isEmptyin interfaceSplitPointDataSource<Sheet,SheetDataSource>- Returns:
- returns true if the manager has no items, false otherwise
-
getSupplements
public Supplements<Sheet> getSupplements()
Description copied from interface:SplitPointDataSourceGets the split point data source supplements.- Specified by:
getSupplementsin interfaceSplitPointDataSource<Sheet,SheetDataSource>- Returns:
- the supplements
-
setCurrentVolumeNumber
public void setCurrentVolumeNumber(int volume)
-
split
public SplitResult<Sheet,SheetDataSource> split(int atIndex)
Description copied from interface:SplitPointDataSourceGets the result of splitting at the specified index. An implementation must be able to handle indexes where
SplitPointDataSource.hasElementAt(int)returns false.If atIndex is 0, the head of the result is empty and the original stream is in the tail. Conversely, if atIndex is greater than
SplitPointDataSource.hasElementAt(int)the head of the result containsSplitPointDataSource.getRemaining()and the tail is empty.- Specified by:
splitin interfaceSplitPointDataSource<Sheet,SheetDataSource>- Parameters:
atIndex- the index where the tail starts- Returns:
- returns a split result at the specified index
-
splitInRange
public SplitResult<Sheet,SheetDataSource> splitInRange(int atIndex)
Description copied from interface:SplitPointDataSourceGets the result of splitting at the specified index.- Specified by:
splitInRangein interfaceSplitPointDataSource<Sheet,SheetDataSource>- Parameters:
atIndex- the index where the tail starts- Returns:
- returns a split result at the specified index
-
createEmpty
public SheetDataSource createEmpty()
Description copied from interface:SplitPointDataSourceCreates a new empty data source of the implementing type.- Specified by:
createEmptyin interfaceSplitPointDataSource<Sheet,SheetDataSource>- Returns:
- returns a new empty data source of the implementing type
-
getDataSource
public SheetDataSource getDataSource()
Description copied from interface:SplitPointDataSourceGets the data source as is, typically "return this".- Specified by:
getDataSourcein interfaceSplitPointDataSource<Sheet,SheetDataSource>- Returns:
- returns the data source
-
-