mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-28 08:43:22 +01:00
63 lines
1.7 KiB
Java
63 lines
1.7 KiB
Java
package org.commonmark.parser;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import org.commonmark.node.SourceSpan;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes11.dex */
|
|
public class SourceLines {
|
|
private final List<SourceLine> lines = new ArrayList();
|
|
|
|
public static SourceLines empty() {
|
|
return new SourceLines();
|
|
}
|
|
|
|
public static SourceLines of(List<SourceLine> list) {
|
|
SourceLines sourceLines = new SourceLines();
|
|
sourceLines.lines.addAll(list);
|
|
return sourceLines;
|
|
}
|
|
|
|
public void addLine(SourceLine sourceLine) {
|
|
this.lines.add(sourceLine);
|
|
}
|
|
|
|
public String getContent() {
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < this.lines.size(); i++) {
|
|
if (i != 0) {
|
|
sb.append('\n');
|
|
}
|
|
sb.append(this.lines.get(i).getContent());
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public List<SourceLine> getLines() {
|
|
return this.lines;
|
|
}
|
|
|
|
public List<SourceSpan> getSourceSpans() {
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator<SourceLine> it2 = this.lines.iterator();
|
|
while (it2.hasNext()) {
|
|
SourceSpan sourceSpan = it2.next().getSourceSpan();
|
|
if (sourceSpan != null) {
|
|
arrayList.add(sourceSpan);
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
return this.lines.isEmpty();
|
|
}
|
|
|
|
public static SourceLines of(SourceLine sourceLine) {
|
|
SourceLines sourceLines = new SourceLines();
|
|
sourceLines.addLine(sourceLine);
|
|
return sourceLines;
|
|
}
|
|
}
|