Package org.anchoranalysis.bean.permute
Class PermutedCopyCreator<T extends AnchorBean<T>>
Object
PermutedCopyCreator<T>
- Type Parameters:
T
- the type of bean which will be copied and permuted.
Applies a
PermuteProperty
to a bean to create new duplicated beans each with different
permuted values.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionPermutedCopyCreator
(Function<T, String> nameGetter, BiConsumer<T, String> nameSetter) Creates a newPermutedCopyCreator
instance. -
Method Summary
Modifier and TypeMethodDescriptioncreatePermutedCopies
(List<T> beans, PermuteProperty<S> propertyToPermute, PermutationAssigner setter) Applies a permutation to a copy of each element in a list of beans, updating the custom name of each bean to reflect the permutation.
-
Constructor Details
-
PermutedCopyCreator
Creates a newPermutedCopyCreator
instance.- Parameters:
nameGetter
- Gets a name from object of typeT
.nameSetter
- sets a name on an object of typeT
.
-
-
Method Details
-
createPermutedCopies
public <S> List<T> createPermutedCopies(List<T> beans, PermuteProperty<S> propertyToPermute, PermutationAssigner setter) throws CreateException Applies a permutation to a copy of each element in a list of beans, updating the custom name of each bean to reflect the permutation.Specifically,
.XXX
is appended to each name, whereXXX
describes the permutation.- Type Parameters:
S
- permutation-type- Parameters:
beans
- list of beans on which a permutation is applied.propertyToPermute
- the property to permute, and all the values for the permutation.setter
- for setting the permutation onto the property.- Returns:
- a list containing the permuted beans.
- Throws:
CreateException
- if something goes wrong.
-