Class TypedClassOperation

java.lang.Object
randoop.operation.TypedOperation
randoop.operation.TypedClassOperation
All Implemented Interfaces:
Comparable<TypedOperation>, Operation
Direct Known Subclasses:
TypedClassOperationWithCast

public class TypedClassOperation extends TypedOperation
Represents a TypedOperation and its declaring class. Examples of TypedOperations that have a declaring class are a method call or field access.
  • Field Details

  • Constructor Details

  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class TypedOperation
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TypedOperation
    • getDeclaringType

      public ClassOrInterfaceType getDeclaringType()
      Returns the class in which the operation is defined.
      Returns:
      class to which the operation belongs
    • substitute

      public TypedClassOperation substitute(Substitution substitution)
      Applies the given substitution to the generic types in this operation, and returns a new operation with the instantiated types.

      Applies the substitution to the declaring type, all input types, and the output type.

      Specified by:
      substitute in class TypedOperation
      Parameters:
      substitution - the substitution
      Returns:
      the operation resulting from applying the substitution to the types of this operation
    • applyCaptureConversion

      public TypedClassOperation applyCaptureConversion()
      Description copied from class: TypedOperation
      Applies a capture conversion to the wildcard types of this operation, and returns a new operation with new type variables for the wildcard types.
      Specified by:
      applyCaptureConversion in class TypedOperation
      Returns:
      the operation result from applying a capture conversion to wildcard types of this operation
    • appendCode

      public void appendCode(List<Variable> inputVars, StringBuilder b)
      Produces a Java source code representation of this operation and appends it to the given StringBuilder.
      Specified by:
      appendCode in class TypedOperation
      Parameters:
      inputVars - the list of variables that are inputs to operation
      b - the StringBuilder to which code is added
    • toParsableString

      public String toParsableString()
      Returns a string representation of this Operation, which can be read by the static parse method for an Operation 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).
      Specified by:
      toParsableString in class TypedOperation
      Returns:
      string descriptor of Operation object
    • toString

      public String toString()
      Overrides:
      toString in class TypedOperation
    • getName

      public String getName()
      Description copied from interface: Operation
      Returns the name for the operation.
      Specified by:
      getName in interface Operation
      Overrides:
      getName in class TypedOperation
      Returns:
      the name for this operation
    • getUnqualifiedBinaryName

      public String getUnqualifiedBinaryName()
      Returns the simple name of this operation, not qualified by the declaring class.
      Returns:
      the unqualified name of this operation
    • hasWildcardTypes

      public boolean hasWildcardTypes()
      Description copied from class: TypedOperation
      Indicates whether this operation has a type that is a wildcard type.
      Specified by:
      hasWildcardTypes in class TypedOperation
      Returns:
      true if at least one input or output type has a wildcard, false otherwise
    • getTypeParameters

      public List<TypeVariable> getTypeParameters()
      Description copied from class: TypedOperation
      Returns an empty list representing the type parameters of this. Clients will mutate the list.
      Overrides:
      getTypeParameters in class TypedOperation
      Returns:
      an empty list representing the type parameters of this
    • getFullyQualifiedSignature

      public String getFullyQualifiedSignature()
      Returns the fully-qualified signature for this operation if it is a method or constructor call.
      Returns:
      this operation's fully qualified signature if it is a method or constructor call, null otherwise
    • getRawSignature

      public RawSignature getRawSignature()
      Returns the RawSignature for this operation if it is a method or constructor call.
      Returns:
      the RawSignature of this method or constructor operation, null if this is another kind of operation
    • getOperationForType

      public TypedClassOperation getOperationForType(ClassOrInterfaceType type)
      Creates an operation with the same name, input types, and output type as this operation, but having the given type as the owning class.

      Note: this is only a valid object if type has the method. This is definitely the case if type is a subtype of the declaring type of the operation, but this method does not force that check because we sometimes want to create the operation for superclasses.

      Parameters:
      type - a type to substitute into the operation
      Returns:
      an operation with type substituted for the declaring type of this operation. The returned object will be invalid if type does not have the method. The returned object may be this, if the argument is already this's declaring type.