Package org.apache.fop.layoutmgr
Class BreakingAlgorithm.BestRecords
- java.lang.Object
-
- org.apache.fop.layoutmgr.BreakingAlgorithm.BestRecords
-
- Direct Known Subclasses:
PageBreakingAlgorithm.BestPageRecords
- Enclosing class:
- BreakingAlgorithm
protected class BreakingAlgorithm.BestRecords extends java.lang.Object
Class that stores, for each fitness class, the best active node that could start a line of the corresponding fitness ending at the current element.
-
-
Field Summary
Fields Modifier and Type Field Description private double[]
bestAdjust
private int[]
bestAvailableShrink
private int[]
bestAvailableStretch
private double[]
bestDemerits
private int[]
bestDifference
private int
bestIndex
Points to the fitness class which currently leads to the best demerits.private BreakingAlgorithm.KnuthNode[]
bestNode
private static double
INFINITE_DEMERITS
-
Constructor Summary
Constructors Constructor Description BestRecords()
default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecord(double demerits, BreakingAlgorithm.KnuthNode node, double adjust, int availableShrink, int availableStretch, int difference, int fitness)
Registers the new best active node for the given fitness class.double
getAdjust(int fitness)
int
getAvailableShrink(int fitness)
int
getAvailableStretch(int fitness)
double
getDemerits(int fitness)
int
getDifference(int fitness)
double
getMinDemerits()
BreakingAlgorithm.KnuthNode
getNode(int fitness)
boolean
hasRecords()
boolean
notInfiniteDemerits(int fitness)
void
reset()
Reset when a new breakpoint is being considered.
-
-
-
Field Detail
-
INFINITE_DEMERITS
private static final double INFINITE_DEMERITS
- See Also:
- Constant Field Values
-
bestDemerits
private final double[] bestDemerits
-
bestNode
private final BreakingAlgorithm.KnuthNode[] bestNode
-
bestAdjust
private final double[] bestAdjust
-
bestDifference
private final int[] bestDifference
-
bestAvailableShrink
private final int[] bestAvailableShrink
-
bestAvailableStretch
private final int[] bestAvailableStretch
-
bestIndex
private int bestIndex
Points to the fitness class which currently leads to the best demerits.
-
-
Method Detail
-
addRecord
public void addRecord(double demerits, BreakingAlgorithm.KnuthNode node, double adjust, int availableShrink, int availableStretch, int difference, int fitness)
Registers the new best active node for the given fitness class.- Parameters:
demerits
- the total demerits of the new optimal set of breakpointsnode
- the node starting the line ending at the current elementadjust
- adjustment ratio of the current lineavailableShrink
- how much the current line can be shrinkedavailableStretch
- how much the current line can be stretcheddifference
- difference between the width of the considered line and the width of the "real" linefitness
- fitness class of the current line
-
hasRecords
public boolean hasRecords()
- Returns:
- true if has records (best index not -1)
-
notInfiniteDemerits
public boolean notInfiniteDemerits(int fitness)
- Parameters:
fitness
- fitness class (0, 1, 2 or 3, i.e. "tight" to "very loose")- Returns:
- true if there is a set of feasible breakpoints registered for the given fitness.
-
getDemerits
public double getDemerits(int fitness)
- Parameters:
fitness
- to use- Returns:
- best demerits
-
getNode
public BreakingAlgorithm.KnuthNode getNode(int fitness)
- Parameters:
fitness
- to use- Returns:
- best node
-
getAdjust
public double getAdjust(int fitness)
- Parameters:
fitness
- to use- Returns:
- adjustment
-
getAvailableShrink
public int getAvailableShrink(int fitness)
- Parameters:
fitness
- to use- Returns:
- available shrink
-
getAvailableStretch
public int getAvailableStretch(int fitness)
- Parameters:
fitness
- to use- Returns:
- available stretch
-
getDifference
public int getDifference(int fitness)
- Parameters:
fitness
- to use- Returns:
- difference
-
getMinDemerits
public double getMinDemerits()
- Returns:
- minimum demerits
-
reset
public void reset()
Reset when a new breakpoint is being considered.
-
-