JAL-2808 new Filters tab in Feature Settings
[jalview.git] / src / jalview / datamodel / features / FeatureAttributes.java
index 7990f6b..d4e9fb0 100644 (file)
@@ -1,7 +1,9 @@
 package jalview.datamodel.features;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
@@ -37,14 +39,34 @@ public class FeatureAttributes
    * @param featureType
    * @return
    */
-  public Iterable<String> getAttributes(String featureType)
+  public List<String> getAttributes(String featureType)
   {
     if (!attributes.containsKey(featureType))
     {
-      return Collections.emptySet();
+      return Collections.<String> emptyList();
     }
 
-    return attributes.get(featureType);
+    return new ArrayList<>(attributes.get(featureType));
+  }
+
+  /**
+   * Answers true if at least one attribute is known for the given feature type,
+   * else false
+   * 
+   * @param featureType
+   * @return
+   */
+  public boolean hasAttributes(String featureType)
+  {
+
+    if (attributes.containsKey(featureType))
+    {
+      if (!attributes.get(featureType).isEmpty())
+      {
+        return true;
+      }
+    }
+    return false;
   }
 
   /**