private void createCode ( ) throws CDKException { List < TreeNode > sphereNodes = null ; TreeNode tn = null ; for ( int f = 0 ; f < atomContainer . getAtomCount ( ) ; f ++ ) { atomContainer . getAtom ( f ) . setFlag ( CDKConstants . VISITED , false ) ; } for ( int f = 0 ; f < maxSphere ; f ++ ) { sphereNodes = spheres [ maxSphere - f ] ; for ( int g = 0 ; g < sphereNodes . size ( ) ; g ++ ) { tn = sphereNodes . get ( g ) ; if ( tn . source != null ) { tn . source . ranking += tn . degree ; } } } for ( int f = 0 ; f < maxSphere ; f ++ ) { sphereNodes = spheres [ f ] ; calculateNodeScores ( sphereNodes ) ; sortNodesByScore ( sphereNodes ) ; } for ( int f = 0 ; f < maxSphere ; f ++ ) { sphereNodes = spheres [ f ] ; for ( int g = 0 ; g < sphereNodes . size ( ) ; g ++ ) { tn = ( TreeNode ) sphereNodes . get ( g ) ; tn . score += tn . ranking ; } sortNodesByScore ( sphereNodes ) ; } for ( int f = 0 ; f < maxSphere ; f ++ ) { sphereNodes = spheres [ f ] ; for ( int g = 0 ; g < sphereNodes . size ( ) ; g ++ ) { tn = ( TreeNode ) sphereNodes . get ( g ) ; String localscore = tn . score + "" ; while ( localscore . length ( ) < 6 ) { localscore = "0" + localscore ; } tn . stringscore = tn . source . stringscore + "" + localscore ; } sortNodesByScore ( sphereNodes ) ; } HOSECode . append ( centerCode ) ; for ( int f = 0 ; f < maxSphere ; f ++ ) { sphere = f + 1 ; sphereNodes = spheres [ f ] ; String s = getSphereCode ( sphereNodes ) ; HOSECode . append ( s ) ; } }
After recursively having established the spheres and assigning each node an appropriate score we now generate the complete HOSE code .