src/main/java/org/helm/notation2/parser/notation/ValidationMethod.java
public static MonomerNotation decideWhichMonomerNotation(String str, String type)
			throws NotationException {
		MonomerNotation mon;
		/* group ? */
		if (str.startsWith("(") && str.endsWith(")")) {
			String str2 = str.substring(1, str.length() - 1);

			Pattern patternAND = Pattern.compile("\\+");
			Pattern patternOR = Pattern.compile(",");
			/* Mixture of elements */
			if (patternAND.matcher(str).find()) {
				mon = new MonomerNotationGroupMixture(str2, type);
			} /* or - groups */ else if (patternOR.matcher(str).find()) {
				mon = new MonomerNotationGroupOr(str2, type);
			} else {
				if (str.contains(".")) {
					mon = new MonomerNotationList(str2, type);
				} else {
					/* monomer unit is just in brackets */
					if (type == "RNA") {
						mon = new MonomerNotationUnitRNA(str2, type);
					} else {
						if (str2.length() > 1) {
							if (!(str2.startsWith("[") && str2.endsWith("]"))) {
								throw new NotationException("Monomers have to be in brackets: " + str);
							}
						}
						mon = new MonomerNotationUnit(str2, type);
					}
				}

			}
		} else {
			if (type == "RNA") {
				// if (str.startsWith("[") && str.endsWith("]")) {
				// mon = new MonomerNotationUnitRNA(str, type);
				// }
				mon = new MonomerNotationUnitRNA(str, type);
			} else if (type != "BLOB") {
				if (str.length() > 1) {
					if (!(str.startsWith("[") && str.endsWith("]"))) {
						throw new NotationException("Monomers have to be in brackets: " + str);
					}
				}
				mon = new MonomerNotationUnit(str, type);
			}
			else{
				mon = new MonomerNotationUnit(str, type);
			}

		}
		return mon;
	}
public static MonomerNotation decideWhichMonomerNotation(String str, String type)
			throws NotationException {
		MonomerNotation mon;
		/* group ? */
		if (str.startsWith("(") && str.endsWith(")")) {
			String str2 = str.substring(1, str.length() - 1);

			Pattern patternAND = Pattern.compile("\\+");
			Pattern patternOR = Pattern.compile(",");
			/* Mixture of elements */
			if (patternAND.matcher(str).find()) {
				mon = new MonomerNotationGroupMixture(str2, type);
			} /* or - groups */ else if (patternOR.matcher(str).find()) {
				mon = new MonomerNotationGroupOr(str2, type);
			} else {
				if (str.contains(".")) {
					mon = new MonomerNotationList(str2, type);
				} else {
					/* monomer unit is just in brackets */
					if (type == "RNA") {
						mon = new MonomerNotationUnitRNA(str2, type);
					} else {
						if (str2.length() > 1) {
							if (!(str2.startsWith("[") && str2.endsWith("]"))) {
								throw new NotationException("Monomers have to be in brackets: " + str);
							}
						}
						mon = new MonomerNotationUnit(str2, type);
					}
				}

			}
		} else {
			if (type == "RNA") {
				// if (str.startsWith("[") && str.endsWith("]")) {
				// mon = new MonomerNotationUnitRNA(str, type);
				// }
				mon = new MonomerNotationUnitRNA(str, type);
			} else if (type != "BLOB") {
				if (str.length() > 1) {
					if (!(str.startsWith("[") && str.endsWith("]"))) {
						throw new NotationException("Monomers have to be in brackets: " + str);
					}
				}
				mon = new MonomerNotationUnit(str, type);
			}
			else{
				mon = new MonomerNotationUnit(str, type);
			}

		}
		return mon;
	}
public static MonomerNotation decideWhichMonomerNotation ( String str , String type ) throws NotationException { MonomerNotation mon ; /* group ? */ if ( str . startsWith ( "(" ) && str . endsWith ( ")" ) ) { String str2 = str . substring ( 1 , str . length ( ) - 1 ) ; Pattern patternAND = Pattern . compile ( "\\+" ) ; Pattern patternOR = Pattern . compile ( "," ) ; /* Mixture of elements */ if ( patternAND . matcher ( str ) . find ( ) ) { mon = new MonomerNotationGroupMixture ( str2 , type ) ; } /* or - groups */ else if ( patternOR . matcher ( str ) . find ( ) ) { mon = new MonomerNotationGroupOr ( str2 , type ) ; } else { if ( str . contains ( "." ) ) { mon = new MonomerNotationList ( str2 , type ) ; } else { /* monomer unit is just in brackets */ if ( type == "RNA" ) { mon = new MonomerNotationUnitRNA ( str2 , type ) ; } else { if ( str2 . length ( ) > 1 ) { if ( ! ( str2 . startsWith ( "[" ) && str2 . endsWith ( "]" ) ) ) { throw new NotationException ( "Monomers have to be in brackets: " + str ) ; } } mon = new MonomerNotationUnit ( str2 , type ) ; } } } } else { if ( type == "RNA" ) { // if (str.startsWith("[") && str.endsWith("]")) {
 // mon = new MonomerNotationUnitRNA(str, type);
 // }
 mon = new MonomerNotationUnitRNA ( str , type ) ; } else if ( type != "BLOB" ) { if ( str . length ( ) > 1 ) { if ( ! ( str . startsWith ( "[" ) && str . endsWith ( "]" ) ) ) { throw new NotationException ( "Monomers have to be in brackets: " + str ) ; } } mon = new MonomerNotationUnit ( str , type ) ; } else { mon = new MonomerNotationUnit ( str , type ) ; } } return mon ; }
method to decide which of the MonomerNotation classes should be
initialized

@param str notation
@param type polymer type
@return MonomerNotation if monomer is not valid
@throws NotationException if notation is not valid
method to decide which of the MonomerNotation classes should be initialized