public final class Statement
extends java.lang.Object
Foo f = m(i1...iN)
or a
declaration int x = 0
. The statement's data includes an operation and the list of inputs
for the operation. The inputs to the operation are variables, but are represented by indexing
into the enclosing sequence.Modifier and Type | Field and Description |
---|---|
(package private) java.util.List<Sequence.RelativeNegativeIndex> |
inputs |
private TypedOperation |
operation
The operation (method call, constructor call, primitive values declaration, etc.).
|
Constructor and Description |
---|
Statement(TypedOperation operation)
Creates a statement based on the given operation.
|
Statement(TypedOperation operation,
java.util.List<Sequence.RelativeNegativeIndex> inputVariables)
Create a new statement of type statement that takes as input the given values.
|
Modifier and Type | Method and Description |
---|---|
void |
appendCode(Variable variable,
java.util.List<Variable> inputs,
java.lang.StringBuilder b)
Adds code for the statement to the given
StringBuilder . |
boolean |
equals(@Nullable java.lang.Object obj)
equals tests whether two Statement objects are equal:
|
ExecutionOutcome |
execute(java.lang.Object[] inputs)
execute performs the operation of the statement for the input variables and returns outcome.
|
@Nullable Type |
getDeclaringClass()
getDeclaringClass returns the declaring class as defined by the
Operation of the
statement. |
@Nullable java.lang.String |
getInlinedForm()
Returns a printed representation of the value as a literal, rather than as a variable
reference.
|
TypeTuple |
getInputTypes() |
TypedOperation |
getOperation()
getTypedOperation is meant to be a temporary solution to type confusion in generators.
|
Type |
getOutputType() |
java.lang.Object |
getValue()
getValue returns the "value" for a statement.
|
int |
hashCode() |
boolean |
isConstructorCall()
isConstructorCall determines if operation for statement is a call to a constructor.
|
boolean |
isMethodCall()
isMethodCall indicates whether a statement corresponds to a method-call-like operation.
|
boolean |
isNonreceivingInitialization()
isNonreceivingInitialization determines if operation is a nonreceiver term.
|
boolean |
isNullInitialization()
isNullInitialization determines if statement represents an initialization by null value.
|
boolean |
isStatic()
isStatic indicates whether the corresponding operation is declared as static.
|
java.lang.String |
toParsableString(java.lang.String variableName,
java.util.List<Variable> inputs) |
java.lang.String |
toString() |
private final TypedOperation operation
final java.util.List<Sequence.RelativeNegativeIndex> inputs
public Statement(TypedOperation operation, java.util.List<Sequence.RelativeNegativeIndex> inputVariables)
operation
- the operation of this statementinputVariables
- the variable that are used in this statementpublic Statement(TypedOperation operation)
operation
- the operation for action of this statementpublic boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public Type getOutputType()
public TypeTuple getInputTypes()
public void appendCode(Variable variable, java.util.List<Variable> inputs, java.lang.StringBuilder b)
StringBuilder
.variable
- the Variable
to be used if an initializationinputs
- the input list for the operation of the statementb
- the StringBuilder
to which code text is appendedSequence.appendCode(StringBuilder, int)
public java.lang.String toParsableString(java.lang.String variableName, java.util.List<Variable> inputs)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isStatic()
public boolean isMethodCall()
public ExecutionOutcome execute(java.lang.Object[] inputs)
inputs
- list of objects to use as inputs to executionpublic @Nullable Type getDeclaringClass()
Operation
of the
statement.public boolean isConstructorCall()
public boolean isNonreceivingInitialization()
public boolean isNullInitialization()
public @Nullable java.lang.String getInlinedForm()
public java.lang.Object getValue()
CallableOperation
to throw appropriate exception when
unable to provide a value.
This is a hack to allow randoop.main.GenBranchDir to do mutation.
public final TypedOperation getOperation()
Sequence.extend(TypedOperation, List)
.