public class VariableReferenceImpl extends Object implements VariableReference
| Modifier and Type | Field and Description |
|---|---|
protected PassiveChangeListener<Void> |
changeListener |
protected Integer |
stPosition |
protected TestCase |
testCase
The testCase in which this VariableReference is valid
|
protected GenericClass |
type
Type (class) of the variable
|
| Constructor and Description |
|---|
VariableReferenceImpl(TestCase testCase,
GenericClass type)
Constructor
|
VariableReferenceImpl(TestCase testCase,
Type type)
Constructor for VariableReferenceImpl.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeClassLoader(ClassLoader loader)
changeClassLoader
|
VariableReference |
clone()
Create a copy of the current variable
|
VariableReference |
clone(TestCase newTestCase)
Create a copy of the current variable for new test
|
int |
compareTo(VariableReference other) |
VariableReference |
copy(TestCase newTestCase,
int offset)
Create a copy of the current variable for new test
|
VariableReference |
getAdditionalVariableReference()
getAdditionalVariableReference
|
String |
getClassName()
Return class name
|
Class<?> |
getComponentClass()
Return raw class of this variable's component
|
String |
getComponentName()
getComponentName
|
Type |
getComponentType()
getComponentType
|
Object |
getDefaultValue()
getDefaultValue
|
String |
getDefaultValueString()
getDefaultValueString
|
int |
getDistance()
Distance metric used to select variables for mutation based on how close
they are to the SUT
|
GenericClass |
getGenericClass()
getGenericClass
|
String |
getName()
Return name for source code representation
|
Object |
getObject(Scope scope)
Return the actual object represented by this variable for a given scope
|
String |
getOriginalCode()
getOriginalCode
|
String |
getSimpleClassName()
Return simple class name
|
int |
getStPosition()
The position of the statement, defining this VariableReference, in the
testcase.
|
TestCase |
getTestCase()
getTestCase
|
Type |
getType()
Return type of this variable
|
Class<?> |
getVariableClass()
Return raw class of this variable
|
boolean |
isAccessible()
Return true if we can validly access this variable.
|
boolean |
isArray()
Return true if variable is an array
|
boolean |
isArrayIndex()
Return true if this is an index into an array variable
|
boolean |
isAssignableFrom(Type other)
Return true if other type can be assigned to this variable
|
boolean |
isAssignableFrom(VariableReference other)
Return true if other type can be assigned to this variable
|
boolean |
isAssignableTo(Type other)
Return true if this variable can by assigned to a variable of other type
|
boolean |
isAssignableTo(VariableReference other)
Return true if this variable can by assigned to a variable of other type
|
boolean |
isEnum()
Return true if variable is an enumeration
|
boolean |
isFieldReference()
Return true if this is a reference to a public field
|
boolean |
isPrimitive()
Return true if variable is a primitive type
|
boolean |
isString()
Return true if variable is a string
|
boolean |
isVoid()
Return true if variable is void
|
boolean |
isWrapperType()
Return true if type of variable is a primitive wrapper
|
void |
loadBytecode(org.objectweb.asm.commons.GeneratorAdapter mg,
Map<Integer,Integer> locals)
loadBytecode
|
void |
replaceAdditionalVariableReference(VariableReference var1,
VariableReference var2)
replaceAdditionalVariableReference
|
boolean |
same(VariableReference r)
same
|
void |
setAdditionalVariableReference(VariableReference var)
setAdditionalVariableReference
|
void |
setDistance(int distance)
Set the distance metric
|
void |
setObject(Scope scope,
Object value)
Set the actual object represented by this variable in a given scope
|
void |
setOriginalCode(String code)
Set the code fragment that defined this variable reference if imported
from an existing test case.
|
void |
setType(Type type)
Set type of this variable
|
void |
storeBytecode(org.objectweb.asm.commons.GeneratorAdapter mg,
Map<Integer,Integer> locals)
storeBytecode
|
String |
toString()
Return string representation of the variable
|
protected GenericClass type
protected TestCase testCase
protected final PassiveChangeListener<Void> changeListener
protected Integer stPosition
public VariableReferenceImpl(TestCase testCase, GenericClass type)
testCase - The TestCase which defines the statement which defines thistype - The type (class) of the variablepublic int getStPosition()
getStPosition in interface VariableReferencepublic TestCase getTestCase()
VariableReferencegetTestCase
getTestCase in interface VariableReferenceTestCase object.public VariableReference clone()
clone in interface VariableReferenceclone in class ObjectVariableReference object.public VariableReference clone(TestCase newTestCase)
clone in interface VariableReferencenewTestCase - a TestCase object.VariableReference object.public VariableReference copy(TestCase newTestCase, int offset)
copy in interface VariableReferencenewTestCase - a TestCase object.offset - a int.VariableReference object.public String getSimpleClassName()
getSimpleClassName in interface VariableReferenceString object.public String getClassName()
getClassName in interface VariableReferenceString object.public String getComponentName()
getComponentName
getComponentName in interface VariableReferenceString object.public Type getComponentType()
getComponentType
getComponentType in interface VariableReferenceType object.public boolean isEnum()
isEnum in interface VariableReferencepublic boolean isArray()
VariableReferenceisArray in interface VariableReferencepublic boolean isArrayIndex()
VariableReferenceisArrayIndex in interface VariableReferencepublic boolean isFieldReference()
VariableReferenceisFieldReference in interface VariableReferencepublic boolean isPrimitive()
isPrimitive in interface VariableReferencepublic boolean isVoid()
isVoid in interface VariableReferencepublic boolean isString()
isString in interface VariableReferencepublic boolean isWrapperType()
isWrapperType in interface VariableReferencepublic boolean isAccessible()
VariableReferenceisAccessible in interface VariableReferencepublic boolean isAssignableFrom(Type other)
isAssignableFrom in interface VariableReferenceother - Right hand side of the assignmentpublic boolean isAssignableTo(Type other)
isAssignableTo in interface VariableReferenceother - Left hand side of the assignmentpublic boolean isAssignableFrom(VariableReference other)
isAssignableFrom in interface VariableReferenceother - Right hand side of the assignmentpublic boolean isAssignableTo(VariableReference other)
isAssignableTo in interface VariableReferenceother - Left hand side of the assignmentpublic Type getType()
getType in interface VariableReferenceType object.public void setType(Type type)
setType in interface VariableReferencetype - a Type object.public Class<?> getVariableClass()
getVariableClass in interface VariableReferenceClass object.public Class<?> getComponentClass()
getComponentClass in interface VariableReferenceClass object.public Object getObject(Scope scope) throws CodeUnderTestException
getObject in interface VariableReferencescope - The scope of the test case executionObject object.CodeUnderTestException - if code from the class under test throws an exception. (E.g.
the static init of a field)public String getOriginalCode()
getOriginalCode
getOriginalCode in interface VariableReferencepublic void setObject(Scope scope, Object value) throws CodeUnderTestException
setObject in interface VariableReferencescope - The scope of the test case executionvalue - The value to be assignedCodeUnderTestException - if code from the class under test throws an exception. (E.g.
the static init of a field)public void setOriginalCode(String code)
setOriginalCode in interface VariableReferencecode - The code fragment that defined this variable reference.public String toString()
toString in interface VariableReferencetoString in class Objectpublic String getName()
getName in interface VariableReferenceString object.public void loadBytecode(org.objectweb.asm.commons.GeneratorAdapter mg,
Map<Integer,Integer> locals)
loadBytecode
loadBytecode in interface VariableReferencemg - a GeneratorAdapter object.locals - a Map object.public void storeBytecode(org.objectweb.asm.commons.GeneratorAdapter mg,
Map<Integer,Integer> locals)
storeBytecode
storeBytecode in interface VariableReferencemg - a GeneratorAdapter object.locals - a Map object.public Object getDefaultValue()
getDefaultValue
getDefaultValue in interface VariableReferenceObject object.public String getDefaultValueString()
getDefaultValueString
getDefaultValueString in interface VariableReferenceString object.public int compareTo(VariableReference other)
compareTo in interface Comparable<VariableReference>compareTo in interface VariableReferencepublic boolean same(VariableReference r)
same
same in interface VariableReferencer - a VariableReference object.public GenericClass getGenericClass()
getGenericClass
getGenericClass in interface VariableReferenceGenericClass object.public VariableReference getAdditionalVariableReference()
getAdditionalVariableReference
getAdditionalVariableReference in interface VariableReferenceVariableReference object.public void setAdditionalVariableReference(VariableReference var)
setAdditionalVariableReference
setAdditionalVariableReference in interface VariableReferencevar - a VariableReference object.public void replaceAdditionalVariableReference(VariableReference var1, VariableReference var2)
replaceAdditionalVariableReference
replaceAdditionalVariableReference in interface VariableReferencevar1 - a VariableReference object.var2 - a VariableReference object.public int getDistance()
getDistance in interface VariableReferencepublic void setDistance(int distance)
setDistance in interface VariableReferencedistance - a int.public void changeClassLoader(ClassLoader loader)
changeClassLoader
changeClassLoader in interface VariableReferenceloader - a ClassLoader object.Copyright © 2010–2017 EvoSuite. All rights reserved.