code: public final static MonomerNotationGroup replaceMonomerNotationGroup(MonomerNotationGroup monomerNotation,
  			String existingMonomerID, String newMonomerID) throws NotationException {
  		MonomerNotationGroup newObject = null;
  		boolean hasChanged = false;
  		StringBuilder sb = new StringBuilder();
  		String id = "";
  		for (MonomerNotationGroupElement object : monomerNotation.getListOfElements()) {
  			if (object.getMonomerNotation().getUnit().equals(existingMonomerID)) {
  				hasChanged = true;
  				id = generateGroupElement(newMonomerID, object.getValue());
  			} else {
  				id = generateGroupElement(object.getMonomerNotation().getUnit(), object.getValue());
  			}
  			if (monomerNotation instanceof MonomerNotationGroupOr) {
  				sb.append(id + ",");
  			} else {
  				sb.append(id + "+");
  			}
  
  		}
  		if (hasChanged) {
  			sb.setLength(sb.length() - 1);
  			if (monomerNotation instanceof MonomerNotationGroupOr) {
  				newObject = new MonomerNotationGroupOr(sb.toString(), monomerNotation.getType());
  			} else {
  				newObject = new MonomerNotationGroupMixture(sb.toString(), monomerNotation.getType());
  			}
  		}
  		return newObject;
  	}
docs: method to replace the MonomerNotationGroup having the MonomerID with the
  new MonomerID
  
  @param monomerNotation
  the to replace monomernotationgroup
  @param existingMonomerID
  the to replace existing monomer id of the monomernotationgroup
  @param newMonomerID
  the new monomerid
  @return MonomerNotationGroup, if it had the old MonomerID, null otherwise
  @throws NotationException
  if the new monomer id is not valid