Package randoop.types

Class TypeTuple

java.lang.Object
randoop.types.TypeTuple
All Implemented Interfaces:
Comparable<TypeTuple>, Iterable<Type>

public class TypeTuple extends Object implements Iterable<Type>, Comparable<TypeTuple>
TypeTuple represents an immutable ordered tuple of Type objects. Type tuples are primarily used to represent the input types of operations.
  • Field Details

    • list

      private final ArrayList<Type> list
      The sequence of types in this type tuple.
  • Constructor Details

    • TypeTuple

      public TypeTuple(List<Type> list)
      Creates a type tuple from the list of types, preserving the order.
      Parameters:
      list - the list of types
    • TypeTuple

      public TypeTuple()
      Creates an empty type tuple.
  • Method Details

    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • substitute

      public TypeTuple substitute(Substitution substitution)
      Applies a substitution to a type tuple, replacing any occurrences of type variables. Resulting tuple may only be partially instantiated. Returns a new TypeTuple; the receiver is not side-effected.
      Parameters:
      substitution - the substitution
      Returns:
      a new type tuple resulting from applying the given substitution to this tuple
    • applyCaptureConversion

      public TypeTuple applyCaptureConversion()
      Applies a capture conversion to each component of this type type tuple. Returns a new TypeTuple; the receiver is not side-effected.
      Returns:
      a new type tuple after performing a capture conversion
    • get

      public Type get(int i)
      Return the ith component type of this tuple.
      Parameters:
      i - the component index
      Returns:
      the component type at the position
    • getTypeParameters

      public List<TypeVariable> getTypeParameters()
      Returns the type parameters that occur in any component of this type tuple.
      Returns:
      the list of type parameters for this type tuple
    • hasWildcard

      public boolean hasWildcard()
      Indicates whether any of the types in this type tuple contains a wildcard.
      Returns:
      true if there is at least one wildcard occurrence
    • hasCaptureVariable

      public boolean hasCaptureVariable()
      Indicates whether any of the types in this type tuple contains a capture variable.
      Returns:
      true if there is at least one capture variable occurrence
    • isEmpty

      public boolean isEmpty()
      Indicates whether the tuple is empty.
      Returns:
      true if the tuple has no components, false otherwise
    • size

      public int size()
      Return the number of components of the tuple.
      Returns:
      the number of components of this tuple
    • isGeneric

      public boolean isGeneric(boolean ignoreWildcards)
      Indicates whether the tuple has any generic components.
      Parameters:
      ignoreWildcards - if true, disregard wildcards when checking for generics
      Returns:
      true if any component of tuple is generic, false if none are
    • iterator

      public Iterator<Type> iterator()
      Specified by:
      iterator in interface Iterable<Type>
    • compareTo

      public int compareTo(TypeTuple tuple)
      Specified by:
      compareTo in interface Comparable<TypeTuple>