public class EnumConstant extends CallableOperation
Modifier and Type | Field and Description |
---|---|
private java.lang.Enum<?> |
value |
Constructor and Description |
---|
EnumConstant(java.lang.Enum<?> value) |
Modifier and Type | Method and Description |
---|---|
void |
appendCode(Type declaringType,
TypeTuple inputTypes,
Type outputType,
java.util.List<Variable> inputVars,
java.lang.StringBuilder b)
Produces a Java source code representation of this statement and appends it to the given
StringBuilder.
|
boolean |
equals(@Nullable java.lang.Object obj) |
boolean |
equalsEnumConstant(EnumConstant e)
Returns true if this equals the given object.
|
ExecutionOutcome |
execute(java.lang.Object[] statementInput)
Performs this operation using the array of input values.
|
java.lang.String |
getName()
Returns the name for the operation.
|
java.lang.Object |
getValue()
Returns the "value" of an operation that is actually a ground term, meaning a constant of some
form.
|
int |
hashCode() |
static TypedClassOperation |
parse(java.lang.String desc)
Parses the description of an enum constant value in a string as returned by
toParsableString(Type, TypeTuple, Type) . |
java.lang.String |
toParsableString(Type declaringType,
TypeTuple inputTypes,
Type outputType)
Returns a string representation of this Operation (not an invocation of this Operation), which
can be read by the static parse method for the class in which the method is defined.
|
java.lang.String |
toString() |
java.lang.Enum<?> |
value()
Returns the object for the value of this enum constant.
|
private static java.lang.Enum<?> |
valueOf(java.lang.Class<?> type,
java.lang.String valueName)
valueOf searches the enum constant list of a class for a constant with the given name.
|
getArgumentString, getReflectionObject, isConstantField, isConstructorCall, isMessage, isMethodCall, isNonreceivingValue, isStatic, isUncheckedCast, satisfies
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public boolean equalsEnumConstant(EnumConstant e)
e
- the value to compare againstpublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
Operation
public ExecutionOutcome execute(java.lang.Object[] statementInput)
execute
in class CallableOperation
statementInput
- array containing appropriate inputs to operationNormalExecution
object holding the value of the enum constantpublic void appendCode(Type declaringType, TypeTuple inputTypes, Type outputType, java.util.List<Variable> inputVars, java.lang.StringBuilder b)
Adds qualified name of enum constant.
appendCode
in class CallableOperation
declaringType
- the declaring type for this operationinputTypes
- the input types for this operationoutputType
- the output type for this operationinputVars
- the list of variables that are inputs to operationb
- the StringBuilder
to which code is addedpublic java.lang.String toParsableString(Type declaringType, TypeTuple inputTypes, Type outputType)
Issues a string representation of an enum constant as a type-value pair. The parse function should return an equivalent object.
toParsableString
in class CallableOperation
declaringType
- the declaring type for this operationinputTypes
- the input types for this operationoutputType
- the output type for this operationparse(String)
public static TypedClassOperation parse(java.lang.String desc) throws OperationParseException
toParsableString(Type, TypeTuple, Type)
.
Valid strings may be of the form EnumType:EnumValue, or OuterClass$InnerEnum:EnumValue for an enum that is an inner type of a class.
desc
- string representing type-value pair for an enum constantOperationParseException
- if desc does not match expected formpublic java.lang.Enum<?> value()
public java.lang.Object getValue()
This is a hack to allow randoop.main.GenBranchDir to do mutation.
getValue
in interface Operation
getValue
in class CallableOperation
private static java.lang.Enum<?> valueOf(java.lang.Class<?> type, java.lang.String valueName)
type
- class that is already known to be an enumvalueName
- name for value that may be a constant of the enum