Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.datamodel.features

File FeatureSources.java

 

Coverage histogram

../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
4
4
1
58
24
4
1
1
4
1

Classes

Class Line # Actions
FeatureSources 13 4 4 0
1.0100%
 

Contributing tests

This file is covered by 5 tests. .

Source view

1    package jalview.datamodel.features;
2   
3    import java.util.HashMap;
4    import java.util.Map;
5   
6    /**
7    * A singleton to hold metadata about feature attributes, keyed by a unique
8    * feature source identifier
9    *
10    * @author gmcarstairs
11    *
12    */
 
13    public class FeatureSources
14    {
15    private static FeatureSources instance = new FeatureSources();
16   
17    private Map<String, FeatureSourceI> sources;
18   
19    /**
20    * Answers the singleton instance of this class
21    *
22    * @return
23    */
 
24  141 toggle public static FeatureSources getInstance()
25    {
26  141 return instance;
27    }
28   
 
29  1 toggle private FeatureSources()
30    {
31  1 sources = new HashMap<>();
32    }
33   
34    /**
35    * Answers the FeatureSource with the given unique identifier, or null if not
36    * known
37    *
38    * @param sourceId
39    * @return
40    */
 
41  137 toggle public FeatureSourceI getSource(String sourceId)
42    {
43  137 return sources.get(sourceId);
44    }
45   
46    /**
47    * Adds the given source under the given key. This will replace any existing
48    * source with the same id, it is the caller's responsibility to ensure keys
49    * are unique if necessary.
50    *
51    * @param sourceId
52    * @param source
53    */
 
54  4 toggle public void addSource(String sourceId, FeatureSource source)
55    {
56  4 sources.put(sourceId, source);
57    }
58    }