private IAtomContainer buildChain ( int length , boolean isMainCyclic ) { IAtomContainer currentChain ; if ( length > 0 ) { //If is cyclic if ( isMainCyclic ) { //Rely on CDK's ring class constructor to generate our cyclic molecules. currentChain = currentMolecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; currentChain . add ( currentMolecule . getBuilder ( ) . newInstance ( IRing . class , length , "C" ) ) ; } //Else must not be cyclic else { currentChain = makeAlkane ( length ) ; } } else { currentChain = currentMolecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; } return currentChain ; }
Builds the main chain which may act as a foundation for futher working groups .