summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/rgens/parser/FlatRuleCase.java
blob: 0cb262613cedddaf7c3a6a58b41ff091c7fc9a1f (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package bjc.rgens.parser;

import bjc.rgens.parser.elements.CaseElement;

import java.util.List;

/**
 * A rule case that inserts nothing in between case elements.
 *
 * @author Ben Culkin
 */
public class FlatRuleCase extends RuleCase {
	/**
	 * Create a new flat rule case.
	 *
	 * @param elms
	 * 	The case elements that make up this case.
	 */
	public FlatRuleCase(List<CaseElement> elms) {
		super(elms);
	}

	@Override
	public void generate(GenerationState state) {
		for(CaseElement elm : elementList) {
			elm.generate(state);
		}
	}

	/**
	 * Create a new flat rule case with the given case elements.
	 *
	 * @param elms
	 * 	The elements to use for the rule case.
	 *
	 * @return A flat rule case, with the given elements.
	 */
	@Override
	public FlatRuleCase withElements(List<CaseElement> elms) {
		return new FlatRuleCase(elms);
	}
}