public final static void replaceMonomer ( HELM2Notation helm2notation , String polymerType , String existingMonomerID , String newMonomerID ) throws NotationException , MonomerException , ChemistryException , CTKException , IOException , JDOMException { validateMonomerReplacement ( polymerType , existingMonomerID , newMonomerID ) ; /* * if(newMonomerID.length()> 1){ if( !( newMonomerID.startsWith("[") && * newMonomerID.endsWith("]"))){ newMonomerID = "[" + newMonomerID + * "]"; } } */ for ( int i = 0 ; i < helm2notation . getListOfPolymers ( ) . size ( ) ; i ++ ) { if ( helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerID ( ) . getType ( ) . equals ( polymerType ) ) { for ( int j = 0 ; j < helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . size ( ) ; j ++ ) { MonomerNotation monomerNotation = replaceMonomerNotation ( helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . get ( j ) , existingMonomerID , newMonomerID ) ; if ( monomerNotation != null ) { helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . set ( j , monomerNotation ) ; } } } } }
method to replace the MonomerID with the new MonomerID for a given polymer type