Search in sources :

Example 11 with AnalysisResult

use of io.github.vocabhunter.analysis.model.AnalysisResult in project VocabHunter by VocabHunter.

the class SimpleAnalyserTest method testEmpty.

@Test
public void testEmpty() {
    AnalysisResult result = analyse();
    assertTrue("Uses", result.getOrderedUses().isEmpty());
}
Also used : AnalysisResult(io.github.vocabhunter.analysis.model.AnalysisResult) Test(org.junit.Test)

Example 12 with AnalysisResult

use of io.github.vocabhunter.analysis.model.AnalysisResult in project VocabHunter by VocabHunter.

the class SimpleAnalyserTest method testLowerLower.

@Test
public void testLowerLower() {
    AnalysisResult result = analyse(LOWER_LOWER);
    validate(result, use(LOWER_CASE, 2, LineReference.FIRST));
}
Also used : AnalysisResult(io.github.vocabhunter.analysis.model.AnalysisResult) Test(org.junit.Test)

Example 13 with AnalysisResult

use of io.github.vocabhunter.analysis.model.AnalysisResult in project VocabHunter by VocabHunter.

the class SimpleAnalyserTest method testLowerCase.

@Test
public void testLowerCase() {
    AnalysisResult result = analyse(LOWER_CASE, LOWER_CASE);
    validate(result, use(LOWER_CASE, 2, LineReference.FIRST, LineReference.SECOND));
}
Also used : AnalysisResult(io.github.vocabhunter.analysis.model.AnalysisResult) Test(org.junit.Test)

Example 14 with AnalysisResult

use of io.github.vocabhunter.analysis.model.AnalysisResult in project VocabHunter by VocabHunter.

the class VocabHunterConsoleExecutable method processInput.

private static void processInput(final VocabHunterConsoleArguments bean, final PrintWriter out) {
    for (String input : bean.getInput()) {
        Path file = Paths.get(input);
        SimpleAnalyser analyser = new SimpleAnalyser();
        FileStreamer streamer = new FileStreamer(analyser);
        WordFilter wordFilter = buildFilter(bean);
        AnalysisResult model = streamer.analyse(file);
        model.getOrderedUses().stream().filter(wordFilter::isShown).forEach(w -> display(out, model.getLines(), w, bean.isHideUses()));
    }
}
Also used : Path(java.nio.file.Path) WordFilter(io.github.vocabhunter.analysis.filter.WordFilter) SimpleAnalyser(io.github.vocabhunter.analysis.simple.SimpleAnalyser) FileStreamer(io.github.vocabhunter.analysis.file.FileStreamer) AnalysisResult(io.github.vocabhunter.analysis.model.AnalysisResult)

Aggregations

AnalysisResult (io.github.vocabhunter.analysis.model.AnalysisResult)14 Test (org.junit.Test)12 FileStreamer (io.github.vocabhunter.analysis.file.FileStreamer)1 WordFilter (io.github.vocabhunter.analysis.filter.WordFilter)1 SimpleAnalyser (io.github.vocabhunter.analysis.simple.SimpleAnalyser)1 Path (java.nio.file.Path)1 Duration (java.time.Duration)1 Instant (java.time.Instant)1