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 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;
}
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 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");
}
}
Aggregations