Search in sources :

Example 86 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 87 with StringJoiner

use of java.util.StringJoiner in project aic-praise by aic-sri-international.

the class QueryController method createParsedModelView.

private HOGMCodeArea createParsedModelView(ParsedHOGModel parseModel) {
    HOGMCodeArea result = new HOGMCodeArea();
    StringJoiner sj = new StringJoiner("\n");
    if (parseModel == null) {
        sj.add("// UNABLE TO PARSE");
    } else {
        sj.add("// SORT DECLARATIONS:");
        parseModel.getSortDeclarations().forEach(sd -> {
            sj.add(sd.getSortDeclaration().toString() + ";");
        });
        if (parseModel.getConstatDeclarations().size() > 0) {
            sj.add("// CONSTANT DECLARATIONS:");
            parseModel.getConstatDeclarations().forEach(cd -> {
                sj.add(cd.getConstantDeclaration().toString() + ";");
            });
        }
        sj.add("// RANDOM VARIABLE DECLARATIONS:");
        parseModel.getRandomVariableDeclarations().forEach(rd -> {
            sj.add(rd.getRandomVariableDeclaration().toString() + ";");
        });
        sj.add("// CONDITIONED POTENTIALS:");
        parseModel.getConditionedPotentials().forEach(cp -> {
            sj.add(cp.toString() + ";");
        });
    }
    result.setText(sj.toString());
    result.setEditable(false);
    return result;
}
Also used : HOGMCodeArea(com.sri.ai.praise.sgsolver.demo.editor.HOGMCodeArea) StringJoiner(java.util.StringJoiner)

Example 88 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 89 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 90 with StringJoiner

use of java.util.StringJoiner in project jabref by JabRef.

the class Linux method openPdfWithParameters.

@Override
public void openPdfWithParameters(String filePath, List<String> parameters) throws IOException {
    String application;
    if (JabRefPreferences.getInstance().get(USE_PDF_READER).equals(JabRefPreferences.getInstance().get(ADOBE_ACROBAT_COMMAND))) {
        application = "acroread";
        StringJoiner sj = new StringJoiner(" ");
        sj.add(application);
        parameters.forEach((param) -> sj.add(param));
        openFileWithApplication(filePath, sj.toString());
    } else {
        openFile(filePath, "PDF");
    }
}
Also used : StringJoiner(java.util.StringJoiner)

Aggregations

StringJoiner (java.util.StringJoiner)98 ArrayList (java.util.ArrayList)22 List (java.util.List)11 IOException (java.io.IOException)6 HashSet (java.util.HashSet)6 Map (java.util.Map)6 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 Field (java.lang.reflect.Field)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