Skip to content

Commit 501a09e

Browse files
committed
Make entity type case insensitive. Also improved docs
1 parent 602b4d5 commit 501a09e

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

biojava-structure/src/main/java/org/biojava/nbio/structure/EntityType.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
package org.biojava.nbio.structure;
2222

2323
/**
24-
*
25-
* The type of entity (polymer, non-polymer, water, macrolide)
24+
* The type of entity (polymer, non-polymer, water, macrolide, branched)
2625
* as defined in the mmCIF dictionary: <a href="http://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v40.dic/Items/_entity.type.html"></a>
2726
* <p>
2827
* Entities are of four types: polymer, non-polymer, macrolide and water.
@@ -76,10 +75,8 @@ public enum EntityType {
7675
/**
7776
* @param entType the type of the Entity
7877
*/
79-
private EntityType(String entType) {
80-
78+
EntityType(String entType) {
8179
this.setEntityType(entType);
82-
8380
}
8481

8582
/**
@@ -101,19 +98,15 @@ private void setEntityType(String entityType) {
10198
* Returns null if entityType is null or not one of the supported
10299
* standard types.
103100
*
104-
* @param entityType String value , should be one of "polymer","non-polymer","water","macrolide"
105-
* @return an EntityType object
101+
* @param entityType should be one of "polymer", "non-polymer", "water", "macrolide", "branched" (case insensitive)
102+
* @return an EntityType object or null if the input string doesn't correspond to a known entity
106103
*/
107-
public static EntityType entityTypeFromString(String entityType)
108-
{
109-
110-
if ( entityType == null)
104+
public static EntityType entityTypeFromString(String entityType) {
105+
if (entityType == null)
111106
return null;
112107

113-
for(EntityType et : EntityType.values())
114-
{
115-
if(entityType.equals(et.entityType))
116-
{
108+
for(EntityType et : EntityType.values()) {
109+
if (entityType.toLowerCase().equals(et.entityType)) {
117110
return et;
118111
}
119112
}

0 commit comments

Comments
 (0)