Search in sources :

Example 1 with ExcelListedFile

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

the class FilterFileWordsExtractorImpl method extractExcelListedFile.

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

Example 2 with ExcelListedFile

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

the class FilterFileModelTranslatorTest method testFromExcel.

@Test
public void testFromExcel() {
    FilterFileModel model = new FilterFileModel(FILE, FilterFileMode.EXCEL, COLUMNS_EXCEL);
    validateFromModel(model, new ExcelListedFile(FILE, COLUMNS_EXCEL));
}
Also used : ExcelListedFile(io.github.vocabhunter.analysis.settings.ExcelListedFile) FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) Test(org.junit.Test)

Example 3 with ExcelListedFile

use of io.github.vocabhunter.analysis.settings.ExcelListedFile 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)

Example 4 with ExcelListedFile

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

the class FilterFileModelTranslatorTest method testToExcel.

@Test
public void testToExcel() {
    ExcelListedFile file = new ExcelListedFile(FILE, COLUMNS_EXCEL);
    validateToModel(file, FilterFileMode.EXCEL, COLUMNS_EXCEL);
}
Also used : ExcelListedFile(io.github.vocabhunter.analysis.settings.ExcelListedFile) Test(org.junit.Test)

Aggregations

ExcelListedFile (io.github.vocabhunter.analysis.settings.ExcelListedFile)4 Test (org.junit.Test)2 VocabHunterException (io.github.vocabhunter.analysis.core.VocabHunterException)1 DocumentListedFile (io.github.vocabhunter.analysis.settings.DocumentListedFile)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