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