Example usage for com.badlogic.gdx.utils StringBuilder append

List of usage examples for com.badlogic.gdx.utils StringBuilder append

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils StringBuilder append.

Prototype

public StringBuilder append(StringBuilder builder) 

Source Link

Usage

From source file:chbachman.api.util.Array.java

License:Apache License

public String toString() {
    if (size == 0)
        return "[]";
    T[] items = this.items;
    StringBuilder buffer = new StringBuilder(32);
    buffer.append('[');
    buffer.append(items[0]);/* www  .java 2  s  .  c om*/
    for (int i = 1; i < size; i++) {
        buffer.append(", ");
        buffer.append(items[i]);
    }
    buffer.append(']');
    return buffer.toString();
}

From source file:chbachman.api.util.Array.java

License:Apache License

public String toString(String separator) {
    if (size == 0)
        return "";
    T[] items = this.items;
    StringBuilder buffer = new StringBuilder(32);
    buffer.append(items[0]);
    for (int i = 1; i < size; i++) {
        buffer.append(separator);/*from  w  ww. ja  v  a  2 s  .  c  om*/
        buffer.append(items[i]);
    }
    return buffer.toString();
}

From source file:chbachman.api.util.ObjectMap.java

License:Apache License

private String toString(String separator, boolean braces) {
    if (size == 0)
        return braces ? "{}" : "";
    StringBuilder buffer = new StringBuilder(32);
    if (braces)/*from  www.  j  a  v a 2s  .c om*/
        buffer.append('{');
    K[] keyTable = this.keyTable;
    V[] valueTable = this.valueTable;
    int i = keyTable.length;
    while (i-- > 0) {
        K key = keyTable[i];
        if (key == null)
            continue;
        buffer.append(key);
        buffer.append('=');
        buffer.append(valueTable[i]);
        break;
    }
    while (i-- > 0) {
        K key = keyTable[i];
        if (key == null)
            continue;
        buffer.append(separator);
        buffer.append(key);
        buffer.append('=');
        buffer.append(valueTable[i]);
    }
    if (braces)
        buffer.append('}');
    return buffer.toString();
}

From source file:chbachman.api.util.OrderedMap.java

License:Apache License

public String toString() {
    if (size == 0)
        return "{}";
    StringBuilder buffer = new StringBuilder(32);
    buffer.append('{');
    Array<K> keys = this.keys;
    for (int i = 0, n = keys.size; i < n; i++) {
        K key = keys.get(i);//from  w  w  w.  j  ava2 s.  c o m
        if (i > 0)
            buffer.append(", ");
        buffer.append(key);
        buffer.append('=');
        buffer.append(get(key));
    }
    buffer.append('}');
    return buffer.toString();
}

From source file:com.badlogic.gdx.ai.tests.BehaviorTreeViewer.java

License:Apache License

private void updateStepLabel() {
    StringBuilder sb = stepLabel.getText();
    sb.setLength(LABEL_STEP.length());//  ww  w.  j av  a2  s  .c o m
    sb.append(step);
    stepLabel.invalidateHierarchy();
}

From source file:com.badlogic.gdx.ai.tests.pfa.tests.tiled.DungeonUtils.java

License:Apache License

public static String mapToString(int[][] map) {
    StringBuilder sb = new StringBuilder(map.length * (map[0].length + 1)); // +1 is due to the new line char
    for (int x = 0; x < map.length; x++) {
        for (int y = 0; y < map[0].length; y++) {
            switch (map[x][y]) {
            case TILE_EMPTY:
                sb.append(' ');
                break;
            case TILE_FLOOR:
                sb.append('.');
                break;
            case TILE_WALL:
                sb.append('#');
                break;
            default:
                sb.append('?');
                break;
            }/* w w  w  .j  a  v a 2s  . c o  m*/
        }
        sb.append('\n');
    }
    return sb.toString();
}

From source file:com.badlogic.gdx.ai.tests.utils.scene2d.FloatValueLabel.java

License:Apache License

@Override
public void act(float delta) {
    float newValue = getValue();
    if (oldValue != newValue) {
        oldValue = newValue;/*  w  w w  .  j  av  a  2 s . co  m*/
        StringBuilder sb = getText();
        sb.setLength(appendIndex);
        sb.append(oldValue);
        invalidateHierarchy();
    }
    super.act(delta);
}

From source file:com.badlogic.gdx.ai.tests.utils.scene2d.IntValueLabel.java

License:Apache License

@Override
public void act(float delta) {
    int newValue = getValue();
    if (oldValue != newValue) {
        oldValue = newValue;/*w  ww.ja va2  s  . c om*/
        StringBuilder sb = getText();
        sb.setLength(appendIndex);
        sb.append(oldValue);
        invalidateHierarchy();
    }
    super.act(delta);
}

From source file:com.kotcrab.vis.ui.util.dialog.Dialogs.java

License:Apache License

private static void getStackTrace(Throwable throwable, StringBuilder builder) {
    String msg = throwable.getMessage();
    if (msg != null) {
        builder.append(msg);
        builder.append("\n\n");
    }/*from   w w w. j a  va  2s .  c om*/

    for (StackTraceElement element : throwable.getStackTrace()) {
        builder.append(element);
        builder.append("\n");
    }

    if (throwable.getCause() != null) {
        builder.append("\nCaused by: ");
        getStackTrace(throwable.getCause(), builder);
    }
}

From source file:com.mygdx.game.ui.ObjectValueLabel.java

License:Apache License

@Override
public void act(float delta) {
    T newValue = getValue();//from   w  ww . j a v  a2 s.c  om
    if (!oldValue.equals(newValue)) {
        copyValue(newValue, oldValue);
        StringBuilder sb = getText();
        sb.setLength(appendIndex);
        sb.append(oldValue);
        invalidateHierarchy();
    }
    super.act(delta);
}