Clover icon

Coverage Report

  1. Project Clover database Mon Nov 18 2024 09:38:20 GMT
  2. Package jalview.viewmodel.seqfeatures

File FeaturesDisplayed.java

 

Coverage histogram

../../../img/srcFileCovDistChart7.png
21% of files have more coverage

Code metrics

0
19
13
1
119
82
13
0.68
1.46
13
1

Classes

Class Line # Actions
FeaturesDisplayed 30 19 13
0.62562.5%
 

Contributing tests

This file is covered by 30 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.viewmodel.seqfeatures;
22   
23    import jalview.api.FeaturesDisplayedI;
24   
25    import java.util.Collection;
26    import java.util.Collections;
27    import java.util.HashSet;
28    import java.util.Set;
29   
 
30    public class FeaturesDisplayed implements FeaturesDisplayedI
31    {
32    private Set<String> featuresDisplayed = new HashSet<>();
33   
34    private Set<String> featuresRegistered = new HashSet<>();
35   
 
36  0 toggle public FeaturesDisplayed(FeaturesDisplayedI featuresDisplayed2)
37    {
38  0 Set<String> fdisp = featuresDisplayed2.getVisibleFeatures();
39  0 for (String ftype : fdisp)
40    {
41  0 featuresDisplayed.add(ftype);
42  0 featuresRegistered.add(ftype);
43    }
44    }
45   
 
46  28 toggle public FeaturesDisplayed()
47    {
48    }
49   
 
50  13 toggle @Override
51    public Set<String> getVisibleFeatures()
52    {
53  13 return Collections.unmodifiableSet(featuresDisplayed);
54    }
55   
 
56  142 toggle @Override
57    public boolean isVisible(String featureType)
58    {
59  142 return featuresDisplayed.contains(featureType);
60    }
61   
 
62  0 toggle @Override
63    public boolean areVisible(Collection<String> featureTypes)
64    {
65  0 return featuresDisplayed.containsAll(featureTypes);
66    }
67   
 
68  11 toggle @Override
69    public void clear()
70    {
71  11 featuresDisplayed.clear();
72  11 featuresRegistered.clear();
73    }
74   
 
75  0 toggle @Override
76    public void setAllVisible(Collection<String> makeVisible)
77    {
78  0 featuresDisplayed.addAll(makeVisible);
79  0 featuresRegistered.addAll(makeVisible);
80    }
81   
 
82  0 toggle @Override
83    public void setAllRegisteredVisible()
84    {
85  0 featuresDisplayed.addAll(featuresRegistered);
86    }
87   
 
88  101 toggle @Override
89    public void setVisible(String featureType)
90    {
91  101 featuresDisplayed.add(featureType);
92  101 featuresRegistered.add(featureType);
93    }
94   
 
95  14 toggle @Override
96    public void setHidden(String featureType)
97    {
98  14 featuresDisplayed.remove(featureType);
99  14 featuresRegistered.add(featureType);
100    }
101   
 
102  1 toggle @Override
103    public boolean isRegistered(String type)
104    {
105  1 return featuresRegistered.contains(type);
106    }
107   
 
108  38 toggle @Override
109    public int getVisibleFeatureCount()
110    {
111  38 return featuresDisplayed.size();
112    }
113   
 
114  13 toggle @Override
115    public int getRegisteredFeaturesCount()
116    {
117  13 return featuresRegistered.size();
118    }
119    }