47 lines
1.0 KiB
Java
47 lines
1.0 KiB
Java
package de.nth.chronicle.gedcom.parser;
|
|
|
|
import de.nth.chronicle.gedcom.Gedcom;
|
|
import lombok.Getter;
|
|
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
|
|
@Getter
|
|
public class GedcomReaderContext {
|
|
|
|
private final Gedcom.GedcomBuilder gedcomBuilder;
|
|
private final List<RecordChunk> recordChunks;
|
|
|
|
private final List<Warning> warnings;
|
|
|
|
private RecordChunk currentChunk;
|
|
private int index = -1;
|
|
|
|
public boolean hasNext() {
|
|
return (this.index+1) < this.recordChunks.size();
|
|
}
|
|
|
|
public RecordChunk nextChunk() {
|
|
this.index++;
|
|
if(this.index >= this.recordChunks.size()) {
|
|
this.currentChunk = null;
|
|
return null;
|
|
}
|
|
this.currentChunk = this.recordChunks.get(this.index);
|
|
return this.currentChunk;
|
|
}
|
|
|
|
public RecordChunk getChunk() {
|
|
return this.currentChunk;
|
|
}
|
|
|
|
GedcomReaderContext(List<RecordChunk> chunks) {
|
|
this.gedcomBuilder = Gedcom.builder();
|
|
this.warnings = new LinkedList<>();
|
|
this.recordChunks = chunks;
|
|
}
|
|
|
|
|
|
|
|
}
|