Search in sources :

Example 1 with SessionListedFile

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

the class FilterFileModelTranslatorImpl method translateSession.

private static FilterFileModel translateSession(final BaseListedFile baseListedFile) {
    SessionListedFile file = (SessionListedFile) baseListedFile;
    FilterFileMode mode;
    if (file.isIncludeUnknown()) {
        mode = FilterFileMode.SESSION_SEEN;
    } else {
        mode = FilterFileMode.SESSION_KNOWN;
    }
    return new FilterFileModel(file.getFile(), mode, Collections.emptySet());
}
Also used : FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) SessionListedFile(io.github.vocabhunter.analysis.settings.SessionListedFile) FilterFileMode(io.github.vocabhunter.gui.model.FilterFileMode)

Example 2 with SessionListedFile

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

the class FilterFileModelTranslatorTest method testFromSessionKnown.

@Test
public void testFromSessionKnown() {
    FilterFileModel model = new FilterFileModel(FILE, FilterFileMode.SESSION_KNOWN, COLUMNS_EMPTY);
    validateFromModel(model, new SessionListedFile(FILE, false));
}
Also used : FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) SessionListedFile(io.github.vocabhunter.analysis.settings.SessionListedFile) Test(org.junit.Test)

Example 3 with SessionListedFile

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

the class FilterFileModelTranslatorTest method testToSessionKnown.

@Test
public void testToSessionKnown() {
    SessionListedFile file = new SessionListedFile(FILE, false);
    validateToModel(file, FilterFileMode.SESSION_KNOWN, COLUMNS_EMPTY);
}
Also used : SessionListedFile(io.github.vocabhunter.analysis.settings.SessionListedFile) Test(org.junit.Test)

Example 4 with SessionListedFile

use of io.github.vocabhunter.analysis.settings.SessionListedFile 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 5 with SessionListedFile

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

the class FilterFileModelTranslatorTest method testToSessionSeen.

@Test
public void testToSessionSeen() {
    SessionListedFile file = new SessionListedFile(FILE, true);
    validateToModel(file, FilterFileMode.SESSION_SEEN, COLUMNS_EMPTY);
}
Also used : SessionListedFile(io.github.vocabhunter.analysis.settings.SessionListedFile) Test(org.junit.Test)

Aggregations

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