Search in sources :

Example 1 with DocumentListedFile

use of io.github.vocabhunter.analysis.settings.DocumentListedFile in project VocabHunter by VocabHunter.

the class FilterFileWordsExtractorImpl method extractDocumentListedFile.

private List<String> extractDocumentListedFile(final BaseListedFile baseListedFile) {
    DocumentListedFile file = (DocumentListedFile) baseListedFile;
    TextGrid grid = textGridManager.readDocument(file.getFile());
    return gridWordsExtractor.words(grid.getLines(), FIRST_COLUMN);
}
Also used : DocumentListedFile(io.github.vocabhunter.analysis.settings.DocumentListedFile)

Example 2 with DocumentListedFile

use of io.github.vocabhunter.analysis.settings.DocumentListedFile in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorTest method testToDocument.

@Test
public void testToDocument() {
    DocumentListedFile file = new DocumentListedFile(FILE);
    validateToModel(file, FilterFileMode.DOCUMENT, COLUMNS_DOCUMENT);
}
Also used : DocumentListedFile(io.github.vocabhunter.analysis.settings.DocumentListedFile) Test(org.junit.Test)

Example 3 with DocumentListedFile

use of io.github.vocabhunter.analysis.settings.DocumentListedFile in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorTest method testFromDocument.

@Test
public void testFromDocument() {
    FilterFileModel model = new FilterFileModel(FILE, FilterFileMode.DOCUMENT, COLUMNS_DOCUMENT);
    validateFromModel(model, new DocumentListedFile(FILE));
}
Also used : DocumentListedFile(io.github.vocabhunter.analysis.settings.DocumentListedFile) FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) Test(org.junit.Test)

Example 4 with DocumentListedFile

use of io.github.vocabhunter.analysis.settings.DocumentListedFile in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorImpl method fromModel.

@Override
public BaseListedFile fromModel(final FilterFileModel model) {
    FilterFileMode mode = model.getMode();
    Path file = model.getFile();
    switch(mode) {
        case SESSION_KNOWN:
            return new SessionListedFile(file, false);
        case SESSION_SEEN:
            return new SessionListedFile(file, true);
        case EXCEL:
            return new ExcelListedFile(file, model.getColumns());
        case DOCUMENT:
            return new DocumentListedFile(file);
        default:
            throw new VocabHunterException("Unsupported mode " + mode);
    }
}
Also used : Path(java.nio.file.Path) DocumentListedFile(io.github.vocabhunter.analysis.settings.DocumentListedFile) VocabHunterException(io.github.vocabhunter.analysis.core.VocabHunterException) ExcelListedFile(io.github.vocabhunter.analysis.settings.ExcelListedFile) FilterFileMode(io.github.vocabhunter.gui.model.FilterFileMode) SessionListedFile(io.github.vocabhunter.analysis.settings.SessionListedFile)

Aggregations

DocumentListedFile (io.github.vocabhunter.analysis.settings.DocumentListedFile)4 Test (org.junit.Test)2 VocabHunterException (io.github.vocabhunter.analysis.core.VocabHunterException)1 ExcelListedFile (io.github.vocabhunter.analysis.settings.ExcelListedFile)1 SessionListedFile (io.github.vocabhunter.analysis.settings.SessionListedFile)1 FilterFileMode (io.github.vocabhunter.gui.model.FilterFileMode)1 FilterFileModel (io.github.vocabhunter.gui.model.FilterFileModel)1 Path (java.nio.file.Path)1