Search in sources :

Example 71 with StringJoiner

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

Example 72 with StringJoiner

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

Example 73 with StringJoiner

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

Example 74 with StringJoiner

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

Example 75 with StringJoiner

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