public static class Layout.Weighted extends Layout
Layout.Weighted
Modifier and Type | Field and Description |
---|---|
private int[] |
weights
The weights.
|
Modifier | Constructor and Description |
---|---|
private |
Layout.Weighted(int... weights)
Create a new weighted layout.
|
Modifier and Type | Method and Description |
---|---|
(package private) int[] |
compute(boolean spaced,
int length,
int[] actualLengths,
int[] minLengths)
Computes the list of lengths for the specifid list of cells with the following constraints:
the sum of the returned array elements must be equals to the
totalLength argument
a cell length should never be lesser than the provided minimum length
The returned array is the list of lengths from left to right, the array size may be less than the
number of cells (i.e the size of the actualLengths and minLengths arguments). |
int[] |
getWeights() |
private final int[] weights
private Layout.Weighted(int... weights) throws NullPointerException, IllegalArgumentException
weights
- the weightsNullPointerException
- if the weights argument is nullIllegalArgumentException
- if any weight is negativepublic int[] getWeights()
int[] compute(boolean spaced, int length, int[] actualLengths, int[] minLengths)
Layout
totalLength
argumentactualLengths
and minLengths
arguments). Missing
cells are just be discarded and not part of the resulting layout. Array should contain only positive values,
any zero length cell should be discarded. When cells must be discarded it must begin with the tail of the
list, i.e it is not allowed to discard a cell that does not have a successor.compute
in class Layout
spaced
- true if the cells are separated by one charlength
- the total length of the lineactualLengths
- the actual length : an estimation of what cell's desired lengthminLengths
- the minmum length : the length under which a cell cannot be renderedCopyright © 2015 eXo Platform SAS. All Rights Reserved.