org.adoptopenjdk.jitwatch.model.bytecode.BCParamSwitch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jitwatch-jarscan-maven-plugin Show documentation
Show all versions of jitwatch-jarscan-maven-plugin Show documentation
A Maven plugin that scans the project artifact and its dependencies for methods that cannot be inlined by the JIT
compiler. It uses the JarScan utility from the JITWatch project to do that.
See https://github.com/AdoptOpenJDK/jitwatch .
The newest version!
/*
* Copyright (c) 2013-2015 Chris Newland.
* Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
* Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
*/
package org.adoptopenjdk.jitwatch.model.bytecode;
import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.adoptopenjdk.jitwatch.util.StringUtil;
public class BCParamSwitch implements IBytecodeParam
{
private Map table = new HashMap<>();
public BCParamSwitch()
{
}
public void put(String key, String value)
{
table.put(key, value);
}
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
List keyList = new ArrayList<>(table.keySet());
Collections.sort(keyList);
for (String key : keyList)
{
String line = new StringBuilder(key).append(C_COLON).append(table.get(key)).toString();
builder.append(StringUtil.alignRight(line, 16)).append(S_NEWLINE);
}
return builder.toString();
}
public String toString(int entryIndex)
{
StringBuilder builder = new StringBuilder();
List keyList = new ArrayList<>(table.keySet());
Collections.sort(keyList);
if (entryIndex < keyList.size())
{
String key = keyList.get(entryIndex);
String line = new StringBuilder(key).append(C_COLON).append(table.get(key)).toString();
builder.append(StringUtil.alignRight(line, 16));
}
return builder.toString();
}
public int getSize()
{
return table.size();
}
@Override
public Map getValue()
{
return table;
}
}