JAL-653 getStrand javadoc/refactor/test
[jalview.git] / src / jalview / datamodel / SequenceFeature.java
index 5fadb6f..e60e0c8 100755 (executable)
@@ -318,23 +318,28 @@ public class SequenceFeature
     return begin;
   }
 
+  /**
+   * Return 1 for forward strand ('+' in GFF), -1 for reverse strand ('-' in
+   * GFF), and 0 for unknown or not (validly) specified
+   * 
+   * @return
+   */
   public int getStrand()
   {
-    String str;
-    if (otherDetails == null
-            || (str = otherDetails.get("STRAND").toString()) == null)
-    {
-      return 0;
-    }
-    if (str.equals("-"))
-    {
-      return -1;
-    }
-    if (str.equals("+"))
+    int strand = 0;
+    if (otherDetails != null)
     {
-      return 1;
+      Object str = otherDetails.get("STRAND");
+      if ("-".equals(str))
+      {
+        strand = -1;
+      }
+      else if ("+".equals(str))
+      {
+        strand = 1;
+      }
     }
-    return 0;
+    return strand;
   }
 
 }