Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 17:27:16 GMT
  2. Package jalview.util.imagemaker

File BitmapImageSizing.java

 

Coverage histogram

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

Code metrics

6
14
11
1
103
60
14
1
1.27
11
1.27

Classes

Class Line # Actions
BitmapImageSizing 25 14 14
0.935483993.5%
 

Contributing tests

This file is covered by 20 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.util.imagemaker;
22   
23    import jalview.bin.Cache;
24   
 
25    public class BitmapImageSizing
26    {
27    private final float scale;
28   
29    private final int width;
30   
31    private final int height;
32   
33    private boolean isDefault = false;
34   
 
35  107 toggle public BitmapImageSizing(float scale, int width, int height,
36    boolean isDefault)
37    {
38  107 this.scale = scale;
39  107 this.width = width;
40  107 this.height = height;
41  107 this.isDefault = isDefault;
42    }
43   
 
44  0 toggle public boolean isNull()
45    {
46  0 return scale == 0.0f && width == 0 && height == 0;
47    }
48   
 
49  1 toggle public static BitmapImageSizing nullBitmapImageSizing()
50    {
51  1 return new BitmapImageSizing(0.0f, 0, 0, false);
52    }
53   
54    public static final String BITMAP_SCALE = "BITMAP_SCALE";
55   
56    public static final String BITMAP_HEIGHT = "BITMAP_HEIGHT";
57   
58    public static final String BITMAP_WIDTH = "BITMAP_WIDTH";
59   
60    /**
61    *
62    * @return bean configured from Cache keys
63    */
 
64  52 toggle public static BitmapImageSizing defaultBitmapImageSizing()
65    {
66  52 return new BitmapImageSizing(0f, 0, 0, true);
67    }
68   
 
69  43 toggle private float defaultScale()
70    {
71  43 return Cache.getDefault(BITMAP_SCALE, 0f);
72    }
73   
 
74  43 toggle private int defaultWidth()
75    {
76  43 return Cache.getDefault(BITMAP_WIDTH, 0);
77    }
78   
 
79  43 toggle private int defaultHeight()
80    {
81  43 return Cache.getDefault(BITMAP_HEIGHT, 0);
82    }
83   
 
84  102 toggle public float scale()
85    {
86  102 return isDefault() ? defaultScale() : scale;
87    }
88   
 
89  103 toggle public int width()
90    {
91  103 return isDefault() ? defaultWidth() : width;
92    }
93   
 
94  102 toggle public int height()
95    {
96  102 return isDefault() ? defaultHeight() : height;
97    }
98   
 
99  307 toggle public boolean isDefault()
100    {
101  307 return isDefault;
102    }
103    }