|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
package com.github.javaparser.printer.concretesyntaxmodel; |
|
|
|
import java.util.List; |
|
import java.util.Objects; |
|
import java.util.stream.Collectors; |
|
|
|
import com.github.javaparser.ast.Node; |
|
import com.github.javaparser.printer.SourcePrinter; |
|
|
|
public class CsmSequence implements CsmElement { |
|
private List<CsmElement> elements; |
|
|
|
public CsmSequence(List<CsmElement> elements) { |
|
if (elements == null) { |
|
throw new NullPointerException(); |
|
} |
|
if (elements.stream().anyMatch(Objects::isNull)) { |
|
throw new IllegalArgumentException("Null element in the sequence"); |
|
} |
|
this.elements = elements; |
|
} |
|
|
|
public List<CsmElement> getElements() { |
|
return elements; |
|
} |
|
|
|
@Override |
|
public void prettyPrint(Node node, SourcePrinter printer) { |
|
elements.forEach(e -> e.prettyPrint(node, printer)); |
|
} |
|
|
|
@Override |
|
public String toString() { |
|
return elements.stream().map(e -> e.toString()).collect(Collectors.joining(",", "CsmSequence[", "]")); |
|
} |
|
} |