class VariableRenamer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Sequence |
sequence
The sequence in which every variable will be renamed.
|
private static int |
VAR_NAME_MAX_DEPTH
Maximum depth to concatenate parameterized type names.
|
Constructor and Description |
---|
VariableRenamer(Sequence sequence) |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
capitalizeString(java.lang.String variableName)
Capitalize the variable name while preserving any capitalized letters after the first letter.
|
(package private) static java.lang.String |
getVariableName(Type type)
Heuristically transforms variables to better names based on its type name.
|
private static java.lang.String |
getVariableName(Type type,
int depth)
Heuristically renames each variable to a name that is based on the variable's type.
|
private static java.lang.String |
lowercaseFirstCharacter(java.lang.String variableName)
Lowercase the first character in the variable name while preserving any capitalized letters
after the first letter.
|
public final Sequence sequence
private static final int VAR_NAME_MAX_DEPTH
public VariableRenamer(Sequence sequence)
static java.lang.String getVariableName(Type type)
int var0 = 1 becomes int int0 = 1
ClassName var0 = new ClassName() becomes ClassName className = new ClassName()
Class var0 = null becomes Class cls = null
Queue<Set<List<Comparable<String>>>> var0 = null becomes Queue<Set<List<Comparable<String>>>> listSetQueue = null
ArrayList<String> var0 = null becomes ArrayList<String> strList = null
type
- the type to use as base of variable nameprivate static java.lang.String getVariableName(Type type, int depth)
type
- the type to use as the base of the variable namedepth
- the number of components (i.e. type arguments) of the type that will be used to
create a name for the variableprivate static java.lang.String capitalizeString(java.lang.String variableName)
variableName
- the name of the variableprivate static java.lang.String lowercaseFirstCharacter(java.lang.String variableName)
variableName
- the name of the variable