Merge branch 'documentation/JAL-3407_2.11.1_release' into releases/Release_2_11_1_Branch
[jalview.git] / src / jalview / datamodel / features / FeatureSource.java
1 package jalview.datamodel.features;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 /**
7  * A class to model one source of feature data, including metadata about
8  * attributes of features
9  * 
10  * @author gmcarstairs
11  *
12  */
13 public class FeatureSource implements FeatureSourceI
14 {
15   private String name;
16
17   private Map<String, String> attributeNames;
18   
19   private Map<String, FeatureAttributeType> attributeTypes;
20   
21   /**
22    * Constructor
23    * 
24    * @param theName
25    */
26   public FeatureSource(String theName)
27   {
28     this.name = theName;
29     attributeNames = new HashMap<>();
30     attributeTypes = new HashMap<>();
31   }
32
33   /**
34    * {@inheritDoc}
35    */
36   @Override
37   public String getName()
38   {
39     return name;
40   }
41
42   /**
43    * {@inheritDoc}
44    */
45   @Override
46   public String getAttributeName(String attributeId)
47   {
48     return attributeNames.get(attributeId);
49   }
50
51   /**
52    * {@inheritDoc}
53    */
54   @Override
55   public FeatureAttributeType getAttributeType(String attributeId)
56   {
57     return attributeTypes.get(attributeId);
58   }
59
60   /**
61    * {@inheritDoc}
62    */
63   @Override
64   public void setAttributeName(String id, String attName)
65   {
66     attributeNames.put(id, attName);
67   }
68
69   /**
70    * {@inheritDoc}
71    */
72   @Override
73   public void setAttributeType(String id, FeatureAttributeType type)
74   {
75     attributeTypes.put(id, type);
76   }
77
78 }