The glyph package deals with assemblies of sections of foreground pixels that are matched against predefined shapes, knowing that these glyphs can be self-standing symbols (such as a clef) or leaves in larger constructions (such as hote heads and stem in a chord).
This is done by {@link omr.glyph.GlyphsBuilder#addGlyph} which performs the following actions:
A (recorded) glyph is never totally deleted, it can be reused then by chance an identical glyph is inserted into the lag. This allows to cache the glyph parameters, moments, forbidden shapes, OCR content, etc.
What {@link omr.glyph.GlyphsBuilder#removeGlyph} does is simply:
A glyph is made visible via its member sections (except for the "selected" glyph(s) which use a specific highlighting mode). Several glyphs may contain the same section, but since the section can point back to at most one glyph, there is at most one "active" glyph for any given section, the other glyphs are thus "inactive".
While stand-alone (i.e. non-member) sections are displayed using a set of 3 different colors, so that adjacent sections can be differentiated, member-sections are colorized with the same color imposed by their containing glyph. Usually, the glyph color is determined by the glyph assigned shape.