blob: 95bb5f94725044f1848c8cdfe2265b2b7d8e211f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package bjc.rgens.parser.elements;
import bjc.rgens.parser.GenerationState;
import bjc.utils.funcdata.FunctionalList;
import bjc.utils.funcdata.IList;
public class InlineRuleCaseElement extends CaseElement {
public final IList<CaseElement> elements;
public InlineRuleCaseElement(String... elements) {
this(new FunctionalList<>(elements).map(CaseElement::createElement));
}
public InlineRuleCaseElement(IList<CaseElement> elements) {
super(ElementType.RULEREF);
this.elements = elements;
}
public void generate(GenerationState state) {
elements.randItem(state.rnd::nextInt).generate(state);
}
}
|