| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | package com.github.javaparser.printer.concretesyntaxmodel; |
| 23 | |
| 24 | import com.github.javaparser.ast.Node; |
| 25 | import com.github.javaparser.printer.SourcePrinter; |
| 26 | |
| 27 | import java.util.List; |
| 28 | import java.util.Objects; |
| 29 | |
| 30 | public class CsmSequence implements CsmElement { |
| 31 | private List<CsmElement> elements; |
| 32 | |
| 33 | public CsmSequence(List<CsmElement> elements) { |
| 34 | if (elements == null) { |
| 35 | throw new NullPointerException(); |
| 36 | } |
| 37 | if (elements.stream().anyMatch(Objects::isNull)) { |
| 38 | throw new IllegalArgumentException("Null element in the sequence"); |
| 39 | } |
| 40 | this.elements = elements; |
| 41 | } |
| 42 | |
| 43 | public List<CsmElement> getElements() { |
| 44 | return elements; |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public void prettyPrint(Node node, SourcePrinter printer) { |
| 49 | elements.forEach(e -> e.prettyPrint(node, printer)); |
| 50 | } |
| 51 | } |
| 52 | |