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

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

Introduction

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

Prototype

@Override
public String toString() 

Source Link

Document

Returns the current String representation.

Usage

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(MapLayers layers, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    for (MapLayer layer : layers)
        hierarchy.append(readableHierarchy(layer, indent));
    return hierarchy.toString();
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(TiledMapTileSets sets, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    for (TiledMapTileSet set : sets)
        hierarchy.append(readableHierarchy(set, indent));
    return hierarchy.toString();
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(MapObjects objects, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    for (MapObject object : objects)
        hierarchy.append(readableHierarchy(object, indent));
    return hierarchy.toString();
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(MapObject object, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    for (int i = 0; i < indent; i++)
        hierarchy.append('\t');
    hierarchy.append(ClassReflection.getSimpleName(object.getClass())).append(' ').append(object.getName())
            .append('\n');
    hierarchy.append(readableHierarchy(object.getProperties(), indent + 1));
    return hierarchy.toString();
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(MapProperties properties, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    Iterator<String> keys = properties.getKeys();
    while (keys.hasNext()) {
        String key = keys.next();
        for (int i = 0; i < indent; i++)
            hierarchy.append('\t');
        hierarchy.append(key).append(": ").append(properties.get(key).toString()).append('\n');
    }/*from  ww w  .  j  a va 2s .co m*/
    return hierarchy.toString();
}

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

License:Apache License

private static String getStackTrace(Throwable throwable) {
    StringBuilder builder = new StringBuilder();
    getStackTrace(throwable, builder);/*from  w w  w . j  a v a 2 s  .c o  m*/
    return builder.toString();
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(TiledMapTileSet set, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    for (int i = 0; i < indent; i++)
        hierarchy.append('\t');
    hierarchy.append(ClassReflection.getSimpleName(set.getClass())).append(' ').append(set.getName())
            .append(" (").append(set.size()).append(" tiles)\n");
    hierarchy.append(readableHierarchy(set.getProperties(), indent + 1));
    for (TiledMapTile tile : set)
        hierarchy.append(readableHierarchy(tile, indent + 1));
    return hierarchy.toString();
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @param map the map to represent
 *  @param indent the indentation size (indent is {@code '\t'})
 *  @return a human-readable hierarchy of the given map and its descendants */
public static String readableHierarchy(Map map, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    for (int i = 0; i < indent; i++)
        hierarchy.append('\t');
    hierarchy.append(ClassReflection.getSimpleName(map.getClass())).append('\n');
    hierarchy.append(readableHierarchy(map.getProperties(), indent + 1));
    if (map instanceof TiledMap)
        hierarchy.append(readableHierarchy(((TiledMap) map).getTileSets(), indent + 1));
    hierarchy.append(readableHierarchy(map.getLayers(), indent + 1));
    return hierarchy.toString();
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(TiledMapTile tile, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    for (int i = 0; i < indent; i++)
        hierarchy.append('\t');
    hierarchy.append(ClassReflection.getSimpleName(tile.getClass())).append(" (ID: ").append(tile.getId())
            .append(", offset: ").append(tile.getOffsetX()).append('x').append(tile.getOffsetY())
            .append(", BlendMode: ").append(tile.getBlendMode()).append(")\n");
    hierarchy.append(readableHierarchy(tile.getProperties(), indent + 1));
    return hierarchy.toString();
}

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 ww .j  a v  a  2 s.com
        }
        sb.append('\n');
    }
    return sb.toString();
}