/** * Prepare a bar checker on the provided sheet * * @param sheet the sheet to process * @param rough true for rough tests (when retrieving staff frames), false for precise tests */ public BarsChecker(Sheet sheet, boolean rough) { this.sheet = sheet; this.rough = rough; scale = sheet.getScale(); suite = new BarCheckSuite(); staffManager = sheet.getStaffManager(); }
// ------------------// // getAlienPixelsIn // // ------------------// private int getAlienPixelsIn(Glyph glyph, Rectangle absRoi) { Predicate<Section> predicate = new Predicate<Section>() { @Override public boolean check(Section section) { return (section.getGlyph() == null) || (section.getGlyph().getShape() != Shape.STAFF_LINE); } }; int total = 0; total += glyph.getAlienPixelsFrom(sheet.getVerticalLag(), absRoi, predicate); total += glyph.getAlienPixelsFrom(sheet.getHorizontalLag(), absRoi, predicate); return total; }
// ---------------// // getCheckBoard // // ---------------// public CheckBoard<GlyphContext> getCheckBoard() { return new BarCheckBoard( getSuite(), sheet.getNest().getGlyphService(), new Class<?>[] {GlyphEvent.class}); }