public static List < IChemObject > getAllChemObjects ( IChemModel chemModel ) { List < IChemObject > list = new ArrayList < IChemObject > ( ) ; // list.add(chemModel); // only add ChemObjects contained within ICrystal crystal = chemModel . getCrystal ( ) ; if ( crystal != null ) { list . add ( crystal ) ; } IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; if ( moleculeSet != null ) { list . add ( moleculeSet ) ; List < IChemObject > current = MoleculeSetManipulator . getAllChemObjects ( moleculeSet ) ; for ( IChemObject chemObject : current ) { if ( ! list . contains ( chemObject ) ) list . add ( chemObject ) ; } } IReactionSet reactionSet = chemModel . getReactionSet ( ) ; if ( reactionSet != null ) { list . add ( reactionSet ) ; List < IChemObject > current = ReactionSetManipulator . getAllChemObjects ( reactionSet ) ; for ( IChemObject chemObject : current ) { if ( ! list . contains ( chemObject ) ) list . add ( chemObject ) ; } } return list ; }
Retrieve a List of all ChemObject objects within an IChemModel .