Search in sources :

Example 41 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project pmd by pmd.

the class ASTStringLiteral method unescape.

/**
 * @since 1.6
 */
public static String unescape(final String string) {
    int u = string.indexOf("\\u");
    if (u < 0) {
        return string;
    }
    final StrBuilder result = new StrBuilder();
    int lastCopied = 0;
    for (; ; ) {
        result.append(string.substring(lastCopied, u));
        /*
             * we don't worry about an exception here, because the lexer checked
             * that string is correct
             */
        final char c = (char) Integer.parseInt(string.substring(u + 2, u + 6), 16);
        result.append(c);
        lastCopied = u + 6;
        u = string.indexOf("\\u", lastCopied);
        if (u < 0) {
            result.append(string.substring(lastCopied));
            return result.toString();
        }
    }
}
Also used : StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Example 42 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project cassandra by apache.

the class HeapUtils method logProcessOutput.

/**
 * Logs the output of the specified process.
 *
 * @param p the process
 * @throws IOException if an I/O problem occurs
 */
private static void logProcessOutput(Process p) throws IOException {
    try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
        StrBuilder builder = new StrBuilder();
        String line;
        while ((line = input.readLine()) != null) {
            builder.appendln(line);
        }
        logger.info(builder.toString());
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Example 43 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project flink by apache.

the class Runner method getAlgorithmsListing.

/**
 * List available algorithms. This is displayed to the user when no valid algorithm is given in
 * the program parameterization.
 *
 * @return usage string listing available algorithms
 */
private static String getAlgorithmsListing() {
    StrBuilder strBuilder = new StrBuilder();
    strBuilder.appendNewLine().appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>").appendNewLine().appendln("Available algorithms:");
    for (Driver algorithm : driverFactory) {
        strBuilder.append("  ").appendFixedWidthPadRight(algorithm.getName(), 30, ' ').append(algorithm.getShortDescription()).appendNewLine();
    }
    return strBuilder.toString();
}
Also used : Driver(org.apache.flink.graph.drivers.Driver) StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Example 44 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project flink by apache.

the class Runner method getAlgorithmUsage.

/**
 * Display the usage for the given algorithm. This includes options for all compatible inputs,
 * the selected algorithm, and outputs implemented by the selected algorithm.
 *
 * @param algorithmName unique identifier of the selected algorithm
 * @return usage string for the given algorithm
 */
private static String getAlgorithmUsage(String algorithmName) {
    StrBuilder strBuilder = new StrBuilder();
    Driver algorithm = driverFactory.get(algorithmName);
    strBuilder.appendNewLine().appendNewLine().appendln(algorithm.getLongDescription()).appendNewLine().append("usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm ").append(algorithmName).append(" [algorithm options] --input <input> [input options] --output <output> [output options]").appendNewLine().appendNewLine().appendln("Available inputs:");
    for (Input input : inputFactory) {
        strBuilder.append("  --input ").append(input.getName()).append(" ").appendln(input.getUsage());
    }
    String algorithmParameterization = algorithm.getUsage();
    if (algorithmParameterization.length() > 0) {
        strBuilder.appendNewLine().appendln("Algorithm configuration:").append("  ").appendln(algorithm.getUsage());
    }
    strBuilder.appendNewLine().appendln("Available outputs:");
    for (Output output : outputFactory) {
        strBuilder.append("  --output ").append(output.getName()).append(" ").appendln(output.getUsage());
    }
    return strBuilder.appendNewLine().toString();
}
Also used : Input(org.apache.flink.graph.drivers.input.Input) Output(org.apache.flink.graph.drivers.output.Output) Driver(org.apache.flink.graph.drivers.Driver) StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Aggregations

StrBuilder (org.apache.commons.lang3.text.StrBuilder)44 GenericInstrument (blue.orchestra.GenericInstrument)9 LinePoint (blue.components.lines.LinePoint)8 Instrument (blue.orchestra.Instrument)5 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)4 Parameter (blue.automation.Parameter)3 NoteParseException (blue.soundObject.NoteParseException)3 ArrayList (java.util.ArrayList)3 Arrangement (blue.Arrangement)2 CompileData (blue.CompileData)2 GlobalOrcSco (blue.GlobalOrcSco)2 Tables (blue.Tables)2 ParameterNameManager (blue.automation.ParameterNameManager)2 Line (blue.components.lines.Line)2 SoundObjectParameterLine (blue.components.lines.SoundObjectParameterLine)2 Mixer (blue.mixer.Mixer)2 TempoMapper (blue.noteProcessor.TempoMapper)2 StringChannelNameManager (blue.orchestra.blueSynthBuilder.StringChannelNameManager)2 EnvelopePoint (blue.orchestra.blueX7.EnvelopePoint)2 CsdRenderResult (blue.services.render.CsdRenderResult)2