Start reimplementation of simplex pattern (#520)

* Start reimplementation of simplex pattern

* Fix suggestions

* Allow nested weighted patterns

* Add documentation and improve error handling

* Remove unnecessary code and obsolete TODOs
This commit is contained in:
Hannes Greule
2020-07-01 14:01:39 +02:00
committed by GitHub
parent 6be429cc96
commit 0bb6bc3563
7 changed files with 253 additions and 7 deletions

View File

@ -52,6 +52,19 @@ public class RandomPattern extends AbstractPattern {
this.random = random;
}
/**
* Create a random pattern from an existing one but with a different random.
*
* @param random the new random to use.
* @param parent the existing random pattern.
*/
public RandomPattern(SimpleRandom random, RandomPattern parent) {
this.random = random;
this.weights = parent.weights;
this.collection = RandomCollection.of(weights, random);
this.patterns = parent.patterns;
}
/**
* Add a pattern to the weight list of patterns.
*