Java Code Examples for com.sun.hotspot.igv.data.Properties#get()

The following examples show how to use com.sun.hotspot.igv.data.Properties#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BinaryParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void parseBlocks(InputGraph graph) throws IOException {
    int blockCount = readInt();
    List<Edge> edges = new LinkedList<>();
    for (int i = 0; i < blockCount; i++) {
        int id = readInt();
        String name = id >= 0 ? Integer.toString(id) : NO_BLOCK;
        InputBlock block = graph.addBlock(name);
        int nodeCount = readInt();
        for (int j = 0; j < nodeCount; j++) {
            int nodeId = readInt();
            if (nodeId < 0) {
                continue;
            }
            final Properties properties = graph.getNode(nodeId).getProperties();
            final String oldBlock = properties.get("block");
            if(oldBlock != null) {
                properties.setProperty("block", oldBlock + ", " + name);
            } else {
                block.addNode(nodeId);
                properties.setProperty("block", name);
            }
        }
        int edgeCount = readInt();
        for (int j = 0; j < edgeCount; j++) {
            int to = readInt();
            edges.add(new Edge(id, to));
        }
    }
    for (Edge e : edges) {
        String fromName = e.from >= 0 ? Integer.toString(e.from) : NO_BLOCK;
        String toName = e.to >= 0 ? Integer.toString(e.to) : NO_BLOCK;
        graph.addBlockEdge(graph.getBlock(fromName), graph.getBlock(toName));
    }
}
 
Example 2
Source File: Figure.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static final String resolveString(String string, Properties properties) {

        StringBuilder sb = new StringBuilder();
        boolean inBrackets = false;
        StringBuilder curIdent = new StringBuilder();

        for (int i = 0; i < string.length(); i++) {
            char c = string.charAt(i);
            if (inBrackets) {
                if (c == ']') {
                    String value = properties.get(curIdent.toString());
                    if (value == null) {
                        value = "";
                    }
                    sb.append(value);
                    inBrackets = false;
                } else {
                    curIdent.append(c);
                }
            } else {
                if (c == '[') {
                    inBrackets = true;
                    curIdent = new StringBuilder();
                } else {
                    sb.append(c);
                }
            }
        }

        return sb.toString();
    }