Package org.daisy.dotify.common.splitter
Class SplitPointHandler<T extends SplitPointUnit,U extends SplitPointDataSource<T,U>>
- java.lang.Object
-
- org.daisy.dotify.common.splitter.SplitPointHandler<T,U>
-
- Type Parameters:
T
- the type of split point unitsU
- the type of data source
public class SplitPointHandler<T extends SplitPointUnit,U extends SplitPointDataSource<T,U>> extends Object
Breaks units into results. All allowed break points are supplied with the input.
-
-
Constructor Summary
Constructors Constructor Description SplitPointHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SplitPointSpecification
find(float breakPoint, U data, SplitOption... options)
Finds a split point at, or before, the supplied breakPoint according to the rules in the data.SplitPointSpecification
find(float breakPoint, U data, SplitPointCost<T> cost, SplitOption... options)
Finds a split point at, or before, the supplied breakPoint according to the rules in the data.static <T extends SplitPointUnit>
SplitPoint<T,SplitPointDataList<T>>split(float breakPoint, List<T> units, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data.static <T extends SplitPointUnit>
SplitPoint<T,SplitPointDataList<T>>split(float breakPoint, List<T> units, SplitPointCost<T> cost, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data.static <T extends SplitPointUnit>
SplitPoint<T,SplitPointDataList<T>>split(float breakPoint, T... units)
Splits the data at, or before, the supplied breakPoint according to the rules in the data.SplitPoint<T,U>
split(float breakPoint, U data, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data.SplitPoint<T,U>
split(float breakPoint, U data, SplitPointCost<T> cost, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data.SplitPoint<T,U>
split(SplitPointSpecification spec, U data)
Splits the data according to the supplied specification.
-
-
-
Method Detail
-
split
@SafeVarargs public static <T extends SplitPointUnit> SplitPoint<T,SplitPointDataList<T>> split(float breakPoint, T... units)
Splits the data at, or before, the supplied breakPoint according to the rules in the data. If force is used, rules may be broken to achieve a result.- Type Parameters:
T
- the type of split point units- Parameters:
breakPoint
- the split pointunits
- the data- Returns:
- returns a split point result
-
split
public static <T extends SplitPointUnit> SplitPoint<T,SplitPointDataList<T>> split(float breakPoint, List<T> units, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data. If force is used, rules may be broken to achieve a result.- Type Parameters:
T
- the type of split point units- Parameters:
breakPoint
- the split pointunits
- the dataoptions
- the split options- Returns:
- returns a split point result
-
split
public static <T extends SplitPointUnit> SplitPoint<T,SplitPointDataList<T>> split(float breakPoint, List<T> units, SplitPointCost<T> cost, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data. If force is used, rules may be broken to achieve a result.- Type Parameters:
T
- the type of split point units- Parameters:
breakPoint
- the split pointunits
- the datacost
- the cost function used when determining the optimal forced split point. In other words, the cost function is only used if there are no breakable units available.options
- the split options- Returns:
- returns a split point result
-
split
public SplitPoint<T,U> split(float breakPoint, U data, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data. If force is used, rules may be broken to achieve a result.- Parameters:
breakPoint
- the split pointdata
- the data to splitoptions
- the split options- Returns:
- returns a split point result
-
split
public SplitPoint<T,U> split(float breakPoint, U data, SplitPointCost<T> cost, SplitOption... options)
Splits the data at, or before, the supplied breakPoint according to the rules in the data. If force is used, rules may be broken to achieve a result.- Parameters:
breakPoint
- the split pointdata
- the data to splitcost
- the cost function used when determining the optimal forced split point. In other words, the cost function is only used if there are no breakable units available.options
- the split options- Returns:
- returns a split point result
- Throws:
IllegalArgumentException
- if cost is null
-
split
public SplitPoint<T,U> split(SplitPointSpecification spec, U data)
Splits the data according to the supplied specification. A specification can be created by using
find(float, SplitPointDataSource, SplitPointCost, SplitOption...)
on the data source.No data is beyond the specified split point is produced using this method. Also, only one of the data producing operations is called, either
SplitPointDataSource.getRemaining()
orSplitPointDataSource.split(int)
.- Parameters:
spec
- the specificationdata
- the data- Returns:
- returns a split point result
-
find
public SplitPointSpecification find(float breakPoint, U data, SplitOption... options)
Finds a split point at, or before, the supplied breakPoint according to the rules in the data. If force is used, rules may be broken to achieve a result.- Parameters:
breakPoint
- the split pointdata
- the data to splitoptions
- the split options- Returns:
- returns a split point specification
-
find
public SplitPointSpecification find(float breakPoint, U data, SplitPointCost<T> cost, SplitOption... options)
Finds a split point at, or before, the supplied breakPoint according to the rules in the data. If force is used, rules may be broken to achieve a result.- Parameters:
breakPoint
- the split pointdata
- the data to splitcost
- the cost function used when determining the optimal forced split point. In other words, the cost function is only used if there are no breakable units available.options
- the split options- Returns:
- returns a split point specification
-
-