dev.secondsun.retro.util.vo.TokenizedFile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of retro-common Show documentation
Show all versions of retro-common Show documentation
This is a library that provides common classes and utilities for secondsun's retro projects.
package dev.secondsun.retro.util.vo;
import java.net.URI;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import dev.secondsun.retro.util.Token;
public class TokenizedFile {
public static final TokenizedFile EMPTY = null;
private Map fileLines = new IdentityHashMap<>();
private Integer lineCount =0;
public URI uri;
public int textLines() {
return lineCount;
}
public void addLine(String line,int index, List tokens) {
fileLines.put(index, new Tokens(line, tokens));
if (index > lineCount) {
lineCount = index;
}
}
public String getLineText(int idx) {
return fileLines.get(idx).line();
}
public List getLineTokens(int idx) {
return fileLines.get(idx).tokens();
}
public URI uri() {
return uri;
}
public void forEach(BiConsumer object) {
fileLines.forEach(object);
}
public Tokens getLine(int idx) {
return fileLines.get(idx);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy