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 forSheet
s. Given a list ofBlockSequence
s, sheets are produced one by one.The input is:
- The list of
BlockSequence
s 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
VolumeKeepPriority
of 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 SheetDataSource
createEmpty()
Creates a new empty data source of the implementing type.Sheet
get(int index)
Gets the item at index.SheetDataSource
getDataSource()
Gets the data source as is, typically "return this
".List<Sheet>
getRemaining()
Gets all remaining items.int
getSize(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.boolean
hasElementAt(int index)
Returns true if the manager has an element at the specified index.boolean
isEmpty()
Returns true if the manager contains no items.void
setCurrentVolumeNumber(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:SplitPointDataSource
Gets the item at index.- Specified by:
get
in interfaceSplitPointDataSource<Sheet,SheetDataSource>
- Parameters:
index
- the index- Returns:
- returns the item
- Throws:
RestartPaginationException
-
getRemaining
public List<Sheet> getRemaining() throws RestartPaginationException
Description copied from interface:SplitPointDataSource
Gets 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:
getRemaining
in interfaceSplitPointDataSource<Sheet,SheetDataSource>
- Returns:
- returns all remaining items
- Throws:
RestartPaginationException
-
hasElementAt
public boolean hasElementAt(int index) throws RestartPaginationException
Description copied from interface:SplitPointDataSource
Returns true if the manager has an element at the specified index.- Specified by:
hasElementAt
in 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 RestartPaginationException
Description copied from interface:SplitPointDataSource
Gets the size of the manager or the limit if the number of items is greater than the limit.- Specified by:
getSize
in interfaceSplitPointDataSource<Sheet,SheetDataSource>
- Parameters:
limit
- the limit- Returns:
- returns the size, or the limit
- Throws:
RestartPaginationException
-
isEmpty
public boolean isEmpty()
Description copied from interface:SplitPointDataSource
Returns true if the manager contains no items. Note that this method can returns true, even ifSplitPointDataSource.getSupplements()
is non-empty.- Specified by:
isEmpty
in interfaceSplitPointDataSource<Sheet,SheetDataSource>
- Returns:
- returns true if the manager has no items, false otherwise
-
getSupplements
public Supplements<Sheet> getSupplements()
Description copied from interface:SplitPointDataSource
Gets the split point data source supplements.- Specified by:
getSupplements
in interfaceSplitPointDataSource<Sheet,SheetDataSource>
- Returns:
- the supplements
-
setCurrentVolumeNumber
public void setCurrentVolumeNumber(int volume)
-
split
public SplitResult<Sheet,SheetDataSource> split(int atIndex)
Description copied from interface:SplitPointDataSource
Gets 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:
split
in 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:SplitPointDataSource
Gets the result of splitting at the specified index.- Specified by:
splitInRange
in 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:SplitPointDataSource
Creates a new empty data source of the implementing type.- Specified by:
createEmpty
in interfaceSplitPointDataSource<Sheet,SheetDataSource>
- Returns:
- returns a new empty data source of the implementing type
-
getDataSource
public SheetDataSource getDataSource()
Description copied from interface:SplitPointDataSource
Gets the data source as is, typically "return this
".- Specified by:
getDataSource
in interfaceSplitPointDataSource<Sheet,SheetDataSource>
- Returns:
- returns the data source
-
-