code: public void addStopCriterion(StopCriterion stopCriterion){
          // acquire status lock
          synchronized(statusLock){
              // assert idle
              assertIdle("Cannot add stop criterion.");
              // pass stop criterion to checker (throws error if incompatible)
              stopCriterionChecker.add(stopCriterion);
              // log
              LOGGER.debug("{}: added stop criterion {}", this, stopCriterion);
          }
      }
docs: Adds a stop criterion used to decide when the search should stop running. It is verified whether the given
  stop criterion is compatible with the search and if not, an exception is thrown. Note that this method can
  only be called when the search is idle.
  
  @param stopCriterion stop criterion used to decide when the search should stop running
  @throws IncompatibleStopCriterionException if the given stop criterion is incompatible with the search
  @throws SearchException if the search is not idle