T
- element-type.public class ScaledElements<T> extends Object
ObjectMask
representation, that have been scaled.
When scaling ObjectMask
s, so as to keep boundaries between objects exact, objects need
to be scaled collectively using a particular interpolation procedure rather than independently.
If any elements overlap with other elements, they are scaled separately independently of the others.
Constructor and Description |
---|
ScaledElements(List<T> elements,
ScaleFactor scaleFactor,
ObjectScalingMethod scalingMethod,
Optional<java.util.function.UnaryOperator<T>> preOperation,
Optional<java.util.function.UnaryOperator<T>> postOperation,
AccessObjectMask<T> access)
Creates elements to be scaled.
|
Modifier and Type | Method and Description |
---|---|
Collection<T> |
asCollectionOrderNotPreserved()
Returns the scaled-elements as a collection but without preserving the original element
order.
|
List<T> |
asListOrderPreserved(List<T> unscaledElements)
Returns a list of scaled-elements corresponding to a list of unscaled-elements.
|
Map<T,T> |
asMap()
The underlying map used to map an unscaled object to its scaled counterpart.
|
T |
scaledObjectFor(T unscaledElement)
Gets the scaled version of an element given the unscaled element.
|
int |
size()
Number of scaled-elements.
|
public ScaledElements(List<T> elements, ScaleFactor scaleFactor, ObjectScalingMethod scalingMethod, Optional<java.util.function.UnaryOperator<T>> preOperation, Optional<java.util.function.UnaryOperator<T>> postOperation, AccessObjectMask<T> access) throws CreateException
elements
- element to be scaled (after possibly a preoperation).scaleFactor
- how much to scale the elements by.scalingMethod
- how the scaling is performed.preOperation
- operation applied to each element before it is scaled (e.g. flattening).postOperation
- operation applied to each element after it is scaled (e.g. flattening).access
- means of retrieving the ObjectMask
that is associated with T
and to create new derived elements.CreateException
- if the internally needed data-structures cannot be successfully
created.public T scaledObjectFor(T unscaledElement) throws GetOperationFailedException
The unscaled element must be an identical to that passed into the constructor.
unscaledElement
- the unscaled-element.GetOperationFailedException
- if the unscaled element was never passed to the
constructor.public Collection<T> asCollectionOrderNotPreserved()
The total number of objects is identical to the unscaled objects, just the order may differ.
public List<T> asListOrderPreserved(List<T> unscaledElements)
unscaledElements
- the list of unscaled-elements (all items must have been previously
passed to the constructor, but the order need not be identical).public Map<T,T> asMap()
public int size()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.