- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {ScheduledThreadPoolExecutor s =
new ScheduledThreadPoolExecutor(corePoolSize)
ThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
String str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
- Smart code suggestions by Codota
}
/** Add history to the map */ public Map<String, Object> convert() { Map<String, Object> map = new IgnoreEmptyKeyMapDecorator<>(new LinkedHashMap<>()); List<Object> list = createEventsList(); map.put(fields.getHistory(), list); return map; }
@SuppressWarnings("unchecked") @Test public void testHistory() throws AnalysisEngineProcessException { jCas.setDocumentText("Bill went to London. William came back."); Person p = Annotations.createPerson(jCas, 0, 4, "Bill"); Person q = Annotations.createPerson(jCas, 21, 28, NAME_2); DocumentHistory documentHistory = history.getHistory("unknown:" + getDocumentAnnotation(jCas).getHash()); documentHistory.add(HistoryEvents.createAdded(p, "test")); documentHistory.add(HistoryEvents.createAdded(q, "test")); documentHistory.add(HistoryEvents.createMerged(p, "test", q.getInternalId())); documentHistory.add(HistoryEvents.createMerged(p, "fakeId merge", 500)); documentHistory.add(HistoryEvents.createRemoved(q, "test")); ae.process(jCas); Collection<HistoryEvent> pHistory = documentHistory.getHistory(p.getInternalId()); Collection<HistoryEvent> qHistory = documentHistory.getHistory(q.getInternalId()); assertEquals(1, documents.count()); assertEquals(2, entities.count()); Document a = entities.find(new Document(Mongo.FIELD_ENTITIES + "." + VALUE, "Bill")).first(); List<Document> pH = (List<Document>) ((List<Document>) a.get(Mongo.FIELD_ENTITIES)).get(0).get(fields.getHistory()); assertEquals(pHistory.size() + qHistory.size(), pH.size()); Document b = entities.find(new Document(Mongo.FIELD_ENTITIES + "." + VALUE, NAME_2)).first(); List<Document> qH = (List<Document>) ((List<Document>) b.get(Mongo.FIELD_ENTITIES)).get(0).get(fields.getHistory()); assertEquals(qHistory.size(), qH.size()); }