src/main/java/org/helm/notation2/parser/notation/ValidationMethod.java
public static HELMEntity decideWhichEntity(String str) throws NotationException {

		HELMEntity item;

		if (str.toUpperCase().matches("PEPTIDE[1-9][0-9]*")) {
			item = new PeptideEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("RNA[1-9][0-9]*")) {
			item = new RNAEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("BLOB[1-9][0-9]*")) {
			item = new BlobEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("CHEM[1-9][0-9]*")) {
			item = new ChemEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("G[1-9][0-9]*")) {
			item = new GroupEntity(str.toUpperCase());
		} else {
			throw new NotationException("ID is wrong: " + str);
		}

		return item;

	}
public static HELMEntity decideWhichEntity(String str) throws NotationException {

		HELMEntity item;

		if (str.toUpperCase().matches("PEPTIDE[1-9][0-9]*")) {
			item = new PeptideEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("RNA[1-9][0-9]*")) {
			item = new RNAEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("BLOB[1-9][0-9]*")) {
			item = new BlobEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("CHEM[1-9][0-9]*")) {
			item = new ChemEntity(str.toUpperCase());
		} else if (str.toUpperCase().matches("G[1-9][0-9]*")) {
			item = new GroupEntity(str.toUpperCase());
		} else {
			throw new NotationException("ID is wrong: " + str);
		}

		return item;

	}
public static HELMEntity decideWhichEntity ( String str ) throws NotationException { HELMEntity item ; if ( str . toUpperCase ( ) . matches ( "PEPTIDE[1-9][0-9]*" ) ) { item = new PeptideEntity ( str . toUpperCase ( ) ) ; } else if ( str . toUpperCase ( ) . matches ( "RNA[1-9][0-9]*" ) ) { item = new RNAEntity ( str . toUpperCase ( ) ) ; } else if ( str . toUpperCase ( ) . matches ( "BLOB[1-9][0-9]*" ) ) { item = new BlobEntity ( str . toUpperCase ( ) ) ; } else if ( str . toUpperCase ( ) . matches ( "CHEM[1-9][0-9]*" ) ) { item = new ChemEntity ( str . toUpperCase ( ) ) ; } else if ( str . toUpperCase ( ) . matches ( "G[1-9][0-9]*" ) ) { item = new GroupEntity ( str . toUpperCase ( ) ) ; } else { throw new NotationException ( "ID is wrong: " + str ) ; } return item ; }
method to decide which of the Entities classes should be initialized

@param str
polymer ID
@return Entity
@throws NotationException if the HELMEntity is not known, ID is not in the right format
method to decide which of the Entities classes should be initialized