Package randoop.operation
Class EnumConstant
java.lang.Object
randoop.operation.CallableOperation
randoop.operation.EnumConstant
- All Implemented Interfaces:
Operation
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendCode
(Type declaringType, TypeTuple inputTypes, Type outputType, List<Variable> inputVars, StringBuilder b) Produces a Java source code representation of this statement and appends it to the given StringBuilder.boolean
boolean
Returns true if this equals the given object.Performs this operation using the array of input values.getName()
Returns the name for the operation.getValue()
Returns the "value" of an operation that is actually a ground term, meaning a constant of some form.int
hashCode()
static TypedClassOperation
Parses the description of an enum constant value in a string as returned bytoParsableString(Type, TypeTuple, Type)
.toParsableString
(Type declaringType, TypeTuple inputTypes, Type outputType) Returns a string representation of this Operation, which can be read by static parse method for class.toString()
Enum<?>
value()
valueprivate static Enum<?>
valueOf searches the enum constant list of a class for a constant with the given name.Methods inherited from class randoop.operation.CallableOperation
getArgumentString, getReflectionObject, isConstantField, isConstructorCall, isMessage, isMethodCall, isNonreceivingValue, isStatic, isUncheckedCast, satisfies
-
Field Details
-
value
-
-
Constructor Details
-
EnumConstant
-
-
Method Details
-
equals
-
equalsEnumConstant
Returns true if this equals the given object.- Parameters:
e
- the value to compare against- Returns:
- true iff this equals the given value
-
hashCode
public int hashCode() -
toString
-
getName
Description copied from interface:Operation
Returns the name for the operation.- Returns:
- the name for this operation
-
execute
Performs this operation using the array of input values. Returns the results of execution as an ResultOrException object and can output results to specified PrintStream.- Specified by:
execute
in classCallableOperation
- Parameters:
statementInput
- array containing appropriate inputs to operation- Returns:
- a
NormalExecution
object holding the value of the enum constant
-
appendCode
public void appendCode(Type declaringType, TypeTuple inputTypes, Type outputType, List<Variable> inputVars, StringBuilder b) Produces a Java source code representation of this statement and appends it to the given StringBuilder.Adds qualified name of enum constant.
- Specified by:
appendCode
in classCallableOperation
- Parameters:
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
- theStringBuilder
to which code is added
-
toParsableString
Returns a string representation of this Operation, which can be read by static parse method for class. For a class C implementing the Operation interface, this method should return a String s such that parsing the string returns an object equivalent to this object, i.e. C.parse(this.s).equals(this).Issues a string representation of an enum constant as a type-value pair. The parse function should return an equivalent object.
- Specified by:
toParsableString
in classCallableOperation
- Parameters:
declaringType
- the declaring type for this operationinputTypes
- the input types for this operationoutputType
- the output type for this operation- Returns:
- a string representation of this operation
- See Also:
-
parse
Parses the description of an enum constant value in a string as returned bytoParsableString(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.
- Parameters:
desc
- string representing type-value pair for an enum constant- Returns:
- the enum constant operation for the string descriptor
- Throws:
OperationParseException
- if desc does not match expected form
-
value
value- Returns:
- object for value of enum constant
-
getValue
Returns the "value" of an operation that is actually a ground term, meaning a constant of some form. Only null if value is null, otherwise throws an exception if there is not a reasonable meaning of value for type of operation.This is a hack to allow randoop.main.GenBranchDir to do mutation.
- Specified by:
getValue
in interfaceOperation
- Overrides:
getValue
in classCallableOperation
- Returns:
- value of enum constant
-
valueOf
valueOf searches the enum constant list of a class for a constant with the given name. Note: cannot make this work using valueOf method of Enum due to typing.- Parameters:
type
- class that is already known to be an enumvalueName
- name for value that may be a constant of the enum- Returns:
- reference to actual constant value, or null if none exists in type
-