Package randoop

Class MultiVisitor

java.lang.Object
randoop.MultiVisitor
All Implemented Interfaces:
ExecutionVisitor

public class MultiVisitor extends Object implements ExecutionVisitor
An execution visitor that chains a list of visitors in sequence. It can be used if the user wants to use more than one visitor to visit a sequence during execution.

When the visitBefore method is called on this visitor, it calls visitMethod on each of the sub-visitors in the order in which the sub-visitors were given when constructing this visitor.

When the visitAfter method is called on this visitor, it calls visitAfter on each of the sub-visitors in turn, also in the order in which they were given when constructing the visitor. If one of these calls returns false, this visitor immediately returns false without calling visitAfter on the remaining visitors.

  • Field Details

  • Constructor Details

    • MultiVisitor

      public MultiVisitor()
      Creates a new MultiVisitor.
    • MultiVisitor

      public MultiVisitor(List<ExecutionVisitor> visitors)
      Creates a new MultiVisitor.
      Parameters:
      visitors - the list of visitors
  • Method Details

    • createMultiVisitor

      public static ExecutionVisitor createMultiVisitor(List<ExecutionVisitor> visitors)
      Returns a MultiVisitor if needed, otherwise a simpler visitor.
      Parameters:
      visitors - the visitors to compose
      Returns:
      a visitor that has the effect of all the visitors in the argument
    • initialize

      public void initialize(ExecutableSequence eseq)
      Calls the initialize method for each of the visitors, in the order in which the visitors were given during construction of this MultiVisitor.
      Specified by:
      initialize in interface ExecutionVisitor
      Parameters:
      eseq - the code sequence to be visited
    • visitAfterStatement

      public void visitAfterStatement(ExecutableSequence eseq, int i)
      Description copied from interface: ExecutionVisitor
      Invoked by ExecutableSequence.execute after the i-th statement executes.

      Precondition: statements 0..i have been executed.

      Specified by:
      visitAfterStatement in interface ExecutionVisitor
      Parameters:
      eseq - the code sequence to be visited
      i - the position of statement to visit
    • visitBeforeStatement

      public void visitBeforeStatement(ExecutableSequence eseq, int i)
      Description copied from interface: ExecutionVisitor
      Invoked by ExecutableSequence.execute before the i-th statement executes.

      Precondition: statements 0..i-1 have been executed.

      Specified by:
      visitBeforeStatement in interface ExecutionVisitor
      Parameters:
      eseq - the code sequence to be visited
      i - the position of statement to visit
    • visitAfterSequence

      public void visitAfterSequence(ExecutableSequence eseq)
      Description copied from interface: ExecutionVisitor
      Called after execution of a sequence.
      Specified by:
      visitAfterSequence in interface ExecutionVisitor
      Parameters:
      eseq - the visited code sequence