use of java.util.StringJoiner in project aic-praise by aic-sri-international.
the class ExpressionFactorsAndTypes method toString.
// END-FactorsAndTypes
//
@Override
public String toString() {
StringJoiner sj = new StringJoiner("\n");
sj.add("factors =" + factors);
sj.add("mapFromRandomVariableNameToTypeName =" + mapFromRandomVariableNameToTypeName);
sj.add("mapFromNonUniquelyNamedConstantNameToTypeName=" + mapFromNonUniquelyNamedConstantNameToTypeName);
sj.add("mapFromUniquelyNamedConstantNameToTypeName =" + mapFromUniquelyNamedConstantNameToTypeName);
sj.add("mapFromCategoricalTypeNameToSizeString =" + mapFromCategoricalTypeNameToSizeString);
sj.add("additionalTypes =" + additionalTypes);
return sj.toString();
}
use of java.util.StringJoiner in project aic-praise by aic-sri-international.
the class HOGMQueryResult method toString.
@Override
public String toString() {
String result = null;
if (isErrors()) {
StringJoiner sj = new StringJoiner("\n", "Query Errors:\n", "\n");
errors.forEach(error -> sj.add(error.toString()));
result = sj.toString();
} else {
result = this.result.toString();
}
return result;
}
use of java.util.StringJoiner in project jena by apache.
the class execTime method exec.
@Override
public NodeValue exec(List<NodeValue> args) {
long now = System.currentTimeMillis();
StringJoiner sj = new StringJoiner(" ", "", "");
args.forEach((a) -> {
sj.add(a.asString());
});
if (lastms != -1)
sj.add("(" + Long.toString(now - lastms) + ")");
String str = sj.toString();
if (!str.isEmpty())
System.err.printf("%s : %d ms\n", str, System.currentTimeMillis());
else
System.err.printf("---- %d ms\n", str, System.currentTimeMillis());
lastms = now;
return NodeValue.TRUE;
}
use of java.util.StringJoiner in project lucene-solr by apache.
the class AtomicUpdateProcessorFactoryTest method testMultipleThreads.
public void testMultipleThreads() throws Exception {
clearIndex();
String[] strings = new String[5];
for (int i = 0; i < 5; i++) {
strings[i] = generateRandomString();
}
List<Thread> threads = new ArrayList<>(100);
//int_i
int finalCount = 0;
for (int i = 0; i < 100; i++) {
int index = random().nextInt(5);
Thread t = new Thread() {
@Override
public void run() {
AddUpdateCommand cmd = new AddUpdateCommand(new LocalSolrQueryRequest(h.getCore(), new ModifiableSolrParams().add("processor", "Atomic").add("Atomic.cat", "add").add("Atomic.int_i", "inc").add("commit", "true")));
cmd.solrDoc = new SolrInputDocument();
//hardcoded id=2
cmd.solrDoc.addField("id", 10);
cmd.solrDoc.addField("cat", strings[index]);
cmd.solrDoc.addField("int_i", index);
try {
AtomicUpdateProcessorFactory factory = new AtomicUpdateProcessorFactory();
factory.inform(h.getCore());
factory.getInstance(cmd.getReq(), new SolrQueryResponse(), new DistributedUpdateProcessor(cmd.getReq(), new SolrQueryResponse(), new RunUpdateProcessor(cmd.getReq(), null))).processAdd(cmd);
} catch (IOException e) {
}
}
};
t.run();
threads.add(t);
//int_i
finalCount += index;
}
for (Thread thread : threads) {
thread.join();
}
assertU(commit());
assertQ("Check the total number of docs", req("q", "id:10"), "//result[@numFound=1]");
StringJoiner queryString = new StringJoiner(" ");
for (String string : strings) {
queryString.add(string);
}
assertQ("Check the total number of docs", req("q", "cat:" + queryString.toString()), "//result[@numFound=1]");
assertQ("Check the total number of docs", req("q", "int_i:" + finalCount), "//result[@numFound=1]");
}
Aggregations