use of java.util.StringJoiner in project intellij-community by JetBrains.
the class JavaReflectionReferenceUtil method getParameterTypesText.
@Nullable
static String getParameterTypesText(@NotNull PsiMethod method) {
final StringJoiner joiner = new StringJoiner(", ");
for (PsiParameter parameter : method.getParameterList().getParameters()) {
final String typeText = getTypeText(parameter.getType(), method);
if (typeText == null)
return null;
joiner.add(typeText + ".class");
}
return joiner.toString();
}
use of java.util.StringJoiner in project aic-praise by aic-sri-international.
the class HuginOutput method newCPT.
//
// START-XFormMarkovToBayes.BayesOutputListener
@Override
public void newCPT(ConditionalProbabilityTable cpt) {
StringJoiner sj = new StringJoiner("\n");
sj.add("potential " + getPotentialSignature(cpt));
sj.add("{");
sj.add(" data = " + getPotentialData(cpt));
sj.add("}");
output(sj.toString());
}
use of java.util.StringJoiner in project aic-praise by aic-sri-international.
the class HOGModelException method getMessage.
@Override
public String getMessage() {
StringJoiner sj = new StringJoiner("\n", "\n", "\n");
errors.forEach(e -> sj.add(e.toString()));
return super.getMessage() + sj.toString();
}
use of java.util.StringJoiner in project aic-praise by aic-sri-international.
the class HuginOutput method getPotentialSignature.
private String getPotentialSignature(ConditionalProbabilityTable cpt) {
StringJoiner sj = new StringJoiner(" ", "(", ")");
sj.add(getLegalHuginId(varIdxToName.get(cpt.getChildVariableIndex())));
sj.add("|");
for (Integer p : cpt.getParentVariableIndexes()) {
sj.add(getLegalHuginId(varIdxToName.get(p)));
}
return sj.toString();
}
use of java.util.StringJoiner in project jabref by JabRef.
the class SearchQueryHighlightObservable method getPatternForWords.
// Returns a regular expression pattern in the form (w1)|(w2)| ... wi are escaped if no regular expression search is enabled
public static Optional<Pattern> getPatternForWords(List<String> words, boolean useRegex, boolean isCaseSensitive) {
if ((words == null) || words.isEmpty() || words.get(0).isEmpty()) {
return Optional.empty();
}
// compile the words to a regular expression in the form (w1)|(w2)|(w3)
StringJoiner joiner = new StringJoiner(")|(", "(", ")");
for (String word : words) {
joiner.add(useRegex ? word : Pattern.quote(word));
}
String searchPattern = joiner.toString();
if (isCaseSensitive) {
return Optional.of(Pattern.compile(searchPattern));
} else {
return Optional.of(Pattern.compile(searchPattern, Pattern.CASE_INSENSITIVE));
}
}
Aggregations