AtomSymbol generatePeriodicSymbol(final int number, final int hydrogens, final int mass, final int charge,
                                      final int unpaired, HydrogenPosition position) {

        TextOutline element = number == 0 ? new TextOutline("*", font)
                                          : new TextOutline(Elements.ofNumber(number).symbol(), font);
        TextOutline hydrogenAdjunct = defaultHydrogenLabel;

        // the hydrogen count, charge, and mass adjuncts are script size
        TextOutline hydrogenCount = new TextOutline(Integer.toString(hydrogens), font).resize(scriptSize, scriptSize);
        TextOutline chargeAdjunct = new TextOutline(chargeAdjunctText(charge, unpaired), font).resize(scriptSize,
                                                                                                      scriptSize);
        TextOutline massAdjunct = new TextOutline(Integer.toString(mass), font).resize(scriptSize, scriptSize);

        // position each adjunct relative to the element label and each other
        hydrogenAdjunct = positionHydrogenLabel(position, element, hydrogenAdjunct);
        hydrogenCount = positionSubscript(hydrogenAdjunct, hydrogenCount);
        chargeAdjunct = positionChargeLabel(hydrogens, position, chargeAdjunct, element, hydrogenAdjunct);
        massAdjunct = positionMassLabel(massAdjunct, element);

        // when the hydrogen label is positioned to the left we may need to nudge it
        // over to account for the hydrogen count and/or the mass adjunct colliding
        // with the element label
        if (position == Left) {
            final double nudgeX = hydrogenXDodge(hydrogens, mass, element, hydrogenAdjunct, hydrogenCount, massAdjunct);
            hydrogenAdjunct = hydrogenAdjunct.translate(nudgeX, 0);
            hydrogenCount = hydrogenCount.translate(nudgeX, 0);
        }

        final List<TextOutline> adjuncts = new ArrayList<TextOutline>(4);

        if (hydrogens > 0) adjuncts.add(hydrogenAdjunct);
        if (hydrogens > 1) adjuncts.add(hydrogenCount);
        if (charge != 0 || unpaired > 0) adjuncts.add(chargeAdjunct);
        if (mass > 0) adjuncts.add(massAdjunct);

        return new AtomSymbol(element, adjuncts);
    }
AtomSymbol generatePeriodicSymbol ( final int number , final int hydrogens , final int mass , final int charge , final int unpaired , HydrogenPosition position ) { TextOutline element = number == 0 ? new TextOutline ( "*" , font ) : new TextOutline ( Elements . ofNumber ( number ) . symbol ( ) , font ) ; TextOutline hydrogenAdjunct = defaultHydrogenLabel ; TextOutline hydrogenCount = new TextOutline ( Integer . toString ( hydrogens ) , font ) . resize ( scriptSize , scriptSize ) ; TextOutline chargeAdjunct = new TextOutline ( chargeAdjunctText ( charge , unpaired ) , font ) . resize ( scriptSize , scriptSize ) ; TextOutline massAdjunct = new TextOutline ( Integer . toString ( mass ) , font ) . resize ( scriptSize , scriptSize ) ; hydrogenAdjunct = positionHydrogenLabel ( position , element , hydrogenAdjunct ) ; hydrogenCount = positionSubscript ( hydrogenAdjunct , hydrogenCount ) ; chargeAdjunct = positionChargeLabel ( hydrogens , position , chargeAdjunct , element , hydrogenAdjunct ) ; massAdjunct = positionMassLabel ( massAdjunct , element ) ; if ( position == Left ) { final double nudgeX = hydrogenXDodge ( hydrogens , mass , element , hydrogenAdjunct , hydrogenCount , massAdjunct ) ; hydrogenAdjunct = hydrogenAdjunct . translate ( nudgeX , 0 ) ; hydrogenCount = hydrogenCount . translate ( nudgeX , 0 ) ; } final List < TextOutline > adjuncts = new ArrayList < TextOutline > ( 4 ) ; if ( hydrogens > 0 ) adjuncts . add ( hydrogenAdjunct ) ; if ( hydrogens > 1 ) adjuncts . add ( hydrogenCount ) ; if ( charge != 0 || unpaired > 0 ) adjuncts . add ( chargeAdjunct ) ; if ( mass > 0 ) adjuncts . add ( massAdjunct ) ; return new AtomSymbol ( element , adjuncts ) ; }
Generate an atom symbol for a periodic element with the specified number of hydrogens, ionic
charge, mass,

@param number    atomic number
@param hydrogens labelled hydrogen count
@param mass      atomic mass
@param charge    ionic formal charge
@param unpaired  number of unpaired electrons
@param position  placement of hydrogen
@return laid out atom symbol