Search in sources :

Example 91 with StringJoiner

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();
}
Also used : StringJoiner(java.util.StringJoiner)

Example 92 with StringJoiner

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;
}
Also used : StringJoiner(java.util.StringJoiner)

Example 93 with StringJoiner

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;
}
Also used : StringJoiner(java.util.StringJoiner)

Example 94 with StringJoiner

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]");
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams) LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) SolrInputDocument(org.apache.solr.common.SolrInputDocument) AddUpdateCommand(org.apache.solr.update.AddUpdateCommand) StringJoiner(java.util.StringJoiner)

Aggregations

StringJoiner (java.util.StringJoiner)94 ArrayList (java.util.ArrayList)20 List (java.util.List)10 HashSet (java.util.HashSet)6 Map (java.util.Map)6 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 Collectors (java.util.stream.Collectors)4 ClassName (com.squareup.javapoet.ClassName)3 FieldSpec (com.squareup.javapoet.FieldSpec)3 ParameterizedTypeName (com.squareup.javapoet.ParameterizedTypeName)3 TypeName (com.squareup.javapoet.TypeName)3 TypeSpec (com.squareup.javapoet.TypeSpec)3 Expression (com.sri.ai.expresso.api.Expression)3 Attribute (io.requery.meta.Attribute)3 Scanner (java.util.Scanner)3 RaptorColumnHandle (com.facebook.presto.raptor.RaptorColumnHandle)2 Range (com.facebook.presto.spi.predicate.Range)2 MaterializedResult (com.facebook.presto.testing.MaterializedResult)2 MaterializedRow (com.facebook.presto.testing.MaterializedRow)2