Clover icon

Coverage Report

  1. Project Clover database Wed Nov 13 2024 16:12:26 GMT
  2. Package jalview.viewmodel.seqfeatures

File FeaturesDisplayed.java

 

Coverage histogram

../../../img/srcFileCovDistChart9.png
13% 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.87587.5%
 

Contributing tests

This file is covered by 77 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  4 toggle public FeaturesDisplayed(FeaturesDisplayedI featuresDisplayed2)
37    {
38  4 Set<String> fdisp = featuresDisplayed2.getVisibleFeatures();
39  4 for (String ftype : fdisp)
40    {
41  8 featuresDisplayed.add(ftype);
42  8 featuresRegistered.add(ftype);
43    }
44    }
45   
 
46  115 toggle public FeaturesDisplayed()
47    {
48    }
49   
 
50  43 toggle @Override
51    public Set<String> getVisibleFeatures()
52    {
53  43 return Collections.unmodifiableSet(featuresDisplayed);
54    }
55   
 
56  753255 toggle @Override
57    public boolean isVisible(String featureType)
58    {
59  753313 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  12 toggle @Override
69    public void clear()
70    {
71  12 featuresDisplayed.clear();
72  12 featuresRegistered.clear();
73    }
74   
 
75  1 toggle @Override
76    public void setAllVisible(Collection<String> makeVisible)
77    {
78  1 featuresDisplayed.addAll(makeVisible);
79  1 featuresRegistered.addAll(makeVisible);
80    }
81   
 
82  0 toggle @Override
83    public void setAllRegisteredVisible()
84    {
85  0 featuresDisplayed.addAll(featuresRegistered);
86    }
87   
 
88  460 toggle @Override
89    public void setVisible(String featureType)
90    {
91  460 featuresDisplayed.add(featureType);
92  460 featuresRegistered.add(featureType);
93    }
94   
 
95  62 toggle @Override
96    public void setHidden(String featureType)
97    {
98  62 featuresDisplayed.remove(featureType);
99  62 featuresRegistered.add(featureType);
100    }
101   
 
102  19 toggle @Override
103    public boolean isRegistered(String type)
104    {
105  19 return featuresRegistered.contains(type);
106    }
107   
 
108  28767 toggle @Override
109    public int getVisibleFeatureCount()
110    {
111  28767 return featuresDisplayed.size();
112    }
113   
 
114  82 toggle @Override
115    public int getRegisteredFeaturesCount()
116    {
117  82 return featuresRegistered.size();
118    }
119    }