IRenderingElement generateSgroups ( IAtomContainer container , AtomSymbol [ ] symbols ) { ElementGroup result = new ElementGroup ( ) ; List < Sgroup > sgroups = container . getProperty ( CDKConstants . CTAB_SGROUPS ) ; if ( sgroups == null || sgroups . isEmpty ( ) ) return result ; Map < IAtom , AtomSymbol > symbolMap = new HashMap <> ( ) ; for ( int i = 0 ; i < symbols . length ; i ++ ) { if ( symbols [ i ] != null ) symbolMap . put ( container . getAtom ( i ) , symbols [ i ] ) ; } for ( Sgroup sgroup : sgroups ) { switch ( sgroup . getType ( ) ) { case CtabAbbreviation : result . add ( generateAbbreviationSgroup ( container , sgroup ) ) ; break ; case CtabMultipleGroup : result . add ( generateMultipleSgroup ( sgroup , symbolMap ) ) ; break ; case CtabAnyPolymer : case CtabMonomer : case CtabCrossLink : case CtabCopolymer : case CtabStructureRepeatUnit : case CtabMer : case CtabGraft : case CtabModified : result . add ( generatePolymerSgroup ( sgroup , symbolMap ) ) ; break ; case CtabComponent : case CtabMixture : case CtabFormulation : result . add ( generateMixtureSgroup ( sgroup ) ) ; break ; case CtabGeneric : // not strictly a polymer but okay to draw as one result . add ( generatePolymerSgroup ( sgroup , null ) ) ; break ; } } return result ; }
Generate the Sgroup elements for the provided atom contains .