Package randoop.sequence
Class Variable
java.lang.Object
randoop.sequence.Variable
- All Implemented Interfaces:
Comparable<Variable>
- Direct Known Subclasses:
DummyVariable
Represents the result of a statement call in a sequence.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate 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
boolean
The statement that produced this variable.int
The index of the statement that creates this value.getName()
Returns the name of this variable.private String
The name of this variable using the given type name and index.getType()
Returns the type of this variable.int
hashCode()
boolean
True if this variable's value should be inlined as a literal at call sites, rather than referencing the variable.toString()
-
Field Details
-
index
public final int index -
sequence
-
-
Constructor Details
-
Variable
-
Variable
protected Variable()Do not use! Only for use by DummyVariable.
-
-
Method Details
-
toString
-
equals
-
hashCode
public int hashCode() -
getType
Returns the type of this variable.- Returns:
- the type of this variable
-
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
Returns the name of this variable.- Returns:
- the name of this variable as a string
-
getName
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
- Specified by:
compareTo
in interfaceComparable<Variable>
-
classToVariableName
Build a variable name from the name of the given type.- Parameters:
type
- the type- Returns:
- the variable name as a string
-
classNameToVariableName
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
-