@NotNull @Override public DataIndexer<Integer, Void, FileContent> getIndexer() { return new DataIndexer<Integer, Void, FileContent>() { @Override @NotNull public Map<Integer, Void> map(FileContent inputData) { final Map<Integer, Void> result = new THashMap<Integer, Void>(); TIntHashSet built = TrigramBuilder.buildTrigram(inputData.getContentAsText()); built.forEach(new TIntProcedure() { @Override public boolean execute(int value) { result.put(value, null); return true; } }); return result; } }; }
@NotNull @Override public DataIndexer<Integer, Void, FileContent> getIndexer() { return new DataIndexer<Integer, Void, FileContent>() { @Override @NotNull public Map<Integer, Void> map(@NotNull FileContent inputData) { MyTrigramProcessor trigramProcessor = new MyTrigramProcessor(); TrigramBuilder.processTrigrams(inputData.getContentAsText(), trigramProcessor); return trigramProcessor.map; } }; }
private static boolean hasTrigrams(@NotNull String text) { return TrigramIndex.ENABLED && !TrigramBuilder.processTrigrams(text, new TrigramBuilder.TrigramProcessor() { @Override public boolean execute(int value) { return false; } }); }
@Nullable public TIntHashSet getCommitsForSubstring(@Nonnull String string) throws StorageException { MyTrigramProcessor trigramProcessor = new MyTrigramProcessor(); TrigramBuilder.processTrigrams(string, trigramProcessor); if (trigramProcessor.map.isEmpty()) return null; return getCommitsWithAllKeys(trigramProcessor.map.keySet()); }
@Nonnull @Override public Map<Integer, Void> map(@Nonnull VcsFullCommitDetails inputData) { MyTrigramProcessor trigramProcessor = new MyTrigramProcessor(); TrigramBuilder.processTrigrams(inputData.getFullMessage(), trigramProcessor); return trigramProcessor.map; }
@Nonnull @Override public DataIndexer<Integer, Void, FileContent> getIndexer() { return new DataIndexer<Integer, Void, FileContent>() { @Override @Nonnull public Map<Integer, Void> map(@Nonnull FileContent inputData) { MyTrigramProcessor trigramProcessor = new MyTrigramProcessor(); TrigramBuilder.processTrigrams(inputData.getContentAsText(), trigramProcessor); return trigramProcessor.map; } }; }
private static boolean hasTrigrams(@Nonnull String text) { return TrigramIndex.ENABLED && !TrigramBuilder.processTrigrams(text, new TrigramBuilder.TrigramProcessor() { @Override public boolean execute(int value) { return false; } }); }