code: private static void contractAbbreviation(IAtomContainer container, Map<IAtom, String> symbolRemap,
                                               Sgroup sgroup) {
  
          final Set<IBond> crossing = sgroup.getBonds();
          final Set<IAtom> atoms = sgroup.getAtoms();
  
          // only do 0,1 attachments for now unless they're all connected to the same atom
          if (crossing.size() > 1) {
              IAtom internal = null;
              for (IBond bond : crossing) {
                  IAtom beg = bond.getBegin();
                  IAtom end = bond.getEnd();
                  if (atoms.contains(beg)) {
                      if (internal != null && !internal.equals(beg)) return; // can't do it
                      internal = beg;
                  } else if (atoms.contains(end)) {
                      if (internal != null && !internal.equals(end)) return; // can't do it
                      internal = end;
                  }
              }
          }
  
          for (IAtom atom : atoms) {
              StandardGenerator.hide(atom);
          }
          for (IBond bond : container.bonds()) {
              if (atoms.contains(bond.getBegin()) ||
                  atoms.contains(bond.getEnd()))
                  StandardGenerator.hide(bond);
          }
          for (IBond bond : crossing) {
              StandardGenerator.unhide(bond);
              IAtom a1 = bond.getBegin();
              IAtom a2 = bond.getEnd();
              StandardGenerator.unhide(a1);
              if (atoms.contains(a1))
                  symbolRemap.put(a1, sgroup.getSubscript());
              StandardGenerator.unhide(a2);
              if (atoms.contains(a2))
                  symbolRemap.put(a2, sgroup.getSubscript());
          }
      }
docs: Hide the atoms and bonds of a contracted abbreviation. If the abbreviations is attached
  we remap the attachment symbol to display the name. If there are no attachments the symbol
  we be added later ({@see #generateSgroups}).
  
  @param container molecule
  @param sgroup    abbreviation group display shortcut