All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.secondsun.retro.util.vo.TokenizedFile Maven / Gradle / Ivy

Go to download

This is a library that provides common classes and utilities for secondsun's retro projects.

There is a newer version: 1.2.6
Show newest version
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