Class OmitMethodsPredicate

java.lang.Object
randoop.reflection.OmitMethodsPredicate

public class OmitMethodsPredicate extends Object
Tests whether the RawSignature of an operation is matched by an omit. If so, the operation should be omitted from the operation set.

A pattern matches an operation representing a constructor, if the pattern matches the RawSignature of the operation. A pattern matches an operation representing a method, if the pattern matches the RawSignature of an operation for which the declaring class is a supertype of TypedClassOperation.getDeclaringType() of the operation. * A constructor may If the operation is a method, a pattern matches the operation if This class provides methods that (1) test the raw signature of an operation, and (2) test the raw signature of an operation and, for an inherited method, that of the same operation in superclasses.

  • Field Details

    • logOmit

      private static boolean logOmit
      Set to true to produce voluminous debugging regarding omission.
    • NO_OMISSION

      public static final OmitMethodsPredicate NO_OMISSION
      An OmitMethodsPredicate that does no omission.
    • omitPatterns

      private final List<Pattern> omitPatterns
      Patterns to match operations that should be omitted. Never side-effected.
  • Constructor Details

    • OmitMethodsPredicate

      public OmitMethodsPredicate(List<Pattern> omitPatterns)
      Create a new OmitMethodsPredicate.
      Parameters:
      omitPatterns - a list of regular expressions for method signatures. May be empty.
  • Method Details

    • shouldOmit

      public boolean shouldOmit(TypedClassOperation operation)
      Indicates whether an omit pattern matches the raw signature of the method, either in the declaring class of the method or in a supertype.
      Parameters:
      operation - the operation for the method or constructor
      Returns:
      true if an omit pattern matches the signature of the method or constructor in the current class (or, for a method, a superclass that defines the method)
    • shouldOmitConstructor

      private boolean shouldOmitConstructor(TypedClassOperation operation)
      Indicates whether an omit pattern matches the raw signature of the constructor.
      Parameters:
      operation - the operation for the method
      Returns:
      true if the signature of the constructor is matched by an omit pattern, false otherwise
    • shouldOmitMethod

      private boolean shouldOmitMethod(TypedClassOperation operation)
      Indicates whether an omit pattern matches the raw signature of the method in either the declaring class of the method or a supertype.
      Parameters:
      operation - the operation for the method
      Returns:
      true if the signature of the method in the current class or a superclass is matched by an omit pattern, false otherwise
    • shouldOmitExact

      private boolean shouldOmitExact(TypedClassOperation operation)
      Returns true if the operation is a constructor or method call and some omit pattern matches the RawSignature of the operation, in the operation's class.

      This method does not check for matches of overridden definitions of the operation in superclasses.

      Parameters:
      operation - the operation to be matched against the omit patterns of this predicate
      Returns:
      true if the signature matches an omit pattern, and false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object