@Override
 public void setResult(Result result) {
   stick.setResult(result);
 }
  /**
   * From the list of vertical sticks, this method uses several tests to provide the initial
   * collection of good barlines candidates.
   *
   * @param sticks the collection of candidate sticks
   */
  public void checkCandidates(Collection<? extends Glyph> sticks) {
    //        // Sort candidates according to their abscissa
    //        List<Glyph> sortedSticks = new ArrayList<Glyph>(sticks);
    //        Collections.sort(sortedSticks, Glyph.midPosComparator);
    double minResult = constants.minCheckResult.getValue();

    // Check each candidate stick in turn
    for (Glyph stick : sticks) {
      // Allocate the candidate context, and pass the whole check suite
      GlyphContext context = new GlyphContext(stick);

      double res = suite.pass(context);

      if (logger.isDebugEnabled() || stick.isVip()) {
        logger.info(
            "suite => {}{} for {}",
            (float) res,
            (stick.getResult() != null) ? (" " + stick.getResult()) : "",
            stick);
      }

      if ((stick.isBar() && stick.isManualShape()) || res >= minResult) {
        // OK, we flag this candidate with proper barline shape
        contexts.put(stick, context);
        if ((!stick.isBar() || !stick.isManualShape())) {
          stick.setShape(isThickBar(stick) ? Shape.THICK_BARLINE : Shape.THIN_BARLINE);
        }

        // Additional processing for Bars that define a system or a part
        // (they start AND end with precise staves horizontal limits)
        if ((context.topStaff != -1) && (context.botStaff != -1)) {
          // Here, we have both part & system defining bars
          // System bars occur first
          // (since glyphs are sorted by increasing abscissa)
          stick.setResult(BAR_PART_DEFINING);

          logger.debug(
              "Part-defining Barline from staff {} to staff {} {}",
              context.topStaff,
              context.botStaff,
              stick);
        } else {
          if (logger.isDebugEnabled()) {
            logger.debug(
                "Non-Part-defining Bar line {}{}",
                (context.topStaff != -1) ? (" topIdx=" + context.topStaff) : "",
                (context.botStaff != -1) ? (" botIdx=" + context.botStaff) : "");
          }

          stick.setResult(BAR_NOT_PART_DEFINING);
        }
      } else {
        if (stick.isBar()) {
          if (logger.isDebugEnabled() || stick.isVip()) {
            logger.info("Purged {} {}", stick.idString(), stick.getShape());
          }

          stick.setShape(null);
        }
      }
    }
  }