Package randoop.sequence
Class Variable
- java.lang.Object
-
- randoop.sequence.Variable
-
- All Implemented Interfaces:
Comparable<Variable>
- Direct Known Subclasses:
DummyVariable
public class Variable extends Object implements Comparable<Variable>
Represents the result of a statement call in a sequence.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static String
classNameToVariableName(String className)
Convert the classname to a variable name, preserving camel case if used.(package private) static String
classToVariableName(Type type)
Build a variable name from the name of the given type.int
compareTo(Variable o)
boolean
equals(Object o)
Statement
getDeclaringStatement()
The statement that produced this variable.int
getDeclIndex()
The index of the statement that creates this value.String
getName()
Returns the name of this variable.private String
getName(String className, int i)
The name of this variable using the given type name and index.Type
getType()
Returns the type of this variable.int
hashCode()
boolean
shouldInlineLiterals()
True if this variable's value should be inlined as a literal at call sites, rather than referencing the variable.String
toString()
-
-
-
Field Detail
-
index
public final int index
-
sequence
public final Sequence sequence
-
-
Constructor Detail
-
Variable
public Variable(Sequence owner, int i)
-
Variable
protected Variable()
Do not use! Only for use by DummyVariable.
-
-
Method Detail
-
getType
public Type getType()
Returns the type of this variable.- Returns:
- the type of this variable
-
getDeclaringStatement
public Statement getDeclaringStatement()
The statement that produced this variable.- Returns:
- the statement to which this variable belongs
-
getDeclIndex
public int getDeclIndex()
The index of the statement that creates this value.- Returns:
- the statement index where this variable is created
-
getName
public String getName()
Returns the name of this variable.- Returns:
- the name of this variable as a string
-
getName
private String getName(String className, int i)
The name of this variable using the given type name and index.- Parameters:
className
- the classname to usei
- the index to use in the name- Returns:
- the variable name that appends the index to the classname
-
compareTo
public int compareTo(Variable o)
- Specified by:
compareTo
in interfaceComparable<Variable>
-
classToVariableName
static String classToVariableName(Type type)
Build a variable name from the name of the given type.- Parameters:
type
- the type- Returns:
- the variable name as a string
-
classNameToVariableName
private static String classNameToVariableName(String className)
Convert the classname to a variable name, preserving camel case if used.- Parameters:
className
- the class name- Returns:
- the variable form of the classname
-
shouldInlineLiterals
public boolean shouldInlineLiterals()
True if this variable's value should be inlined as a literal at call sites, rather than referencing the variable.- Returns:
- whether this variable's value should be inlined as a literal at call sites
-
-