Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 15:05:32 GMT
  2. Package jalview.datamodel

File FloatContactMatrix.java

 

Coverage histogram

../../img/srcFileCovDistChart8.png
20% of files have more coverage

Code metrics

8
28
14
1
152
104
20
0.71
2
14
1.43

Classes

Class Line # Actions
FloatContactMatrix 23 28 20
0.7676%
 

Contributing tests

This file is covered by 37 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.datamodel;
22   
 
23    public class FloatContactMatrix extends GroupSetHolder
24    implements ContactMatrixI
25    {
26   
27    int maxrow = 0, maxcol = 0;
28   
29    float[][] elements;
30   
31    float maxscore;
32   
 
33  58 toggle public FloatContactMatrix(float[][] matrix)
34    {
35  58 maxcol = 0;
36  58 for (float[] row : matrix)
37    {
38  10765 if (row.length > maxcol)
39    {
40  58 maxcol = row.length;
41    }
42  10765 maxscore = row[0];
43  10765 for (float f : row)
44    {
45  7897553 if (maxscore < f)
46    {
47  21449 maxscore = f;
48    }
49    }
50    }
51  58 maxrow = matrix.length;
52  58 elements = matrix;
53    }
54   
 
55  3 toggle public FloatContactMatrix(float[][] elements2, GroupSet grps2)
56    {
57  3 this(elements2);
58  3 setGroupSet(grps2);
59    }
60   
61    /**
62    * getContactList(column) @returns the vector of predicted alignment errors
63    * for reference position given by column
64    */
 
65  3917 toggle @Override
66    public ContactListI getContactList(final int column)
67    {
68  3917 if (column < 0 || column >= elements.length)
69    {
70  0 return null;
71    }
72   
73  3917 return new ContactListImpl(new ContactListProviderI()
74    {
 
75  0 toggle @Override
76    public int getPosition()
77    {
78  0 return column;
79    }
80   
 
81  4002539 toggle @Override
82    public int getContactHeight()
83    {
84  4002539 return maxcol - 1;
85    }
86   
 
87  4210778 toggle @Override
88    public double getContactAt(int mcolumn)
89    {
90  4210778 if (mcolumn < 0 || mcolumn >= elements[column].length)
91    {
92  0 return -1;
93    }
94  4210778 return elements[column][mcolumn];
95    }
96    });
97    }
98   
99    /**
100    * getElementAt(column, i) @returns the predicted superposition error for the
101    * ith position when column is used as reference
102    */
 
103  414932 toggle @Override
104    public double getElementAt(int _column, int i)
105    {
106  414933 return elements[_column][i];
107    }
108   
 
109  120 toggle @Override
110    public float getMin()
111    {
112  120 return 0;
113    }
114   
 
115  127 toggle @Override
116    public float getMax()
117    {
118  127 return maxscore;
119    }
120   
 
121  0 toggle @Override
122    public String getAnnotDescr()
123    {
124    // TODO Auto-generated method stub
125  0 return null;
126    }
127   
 
128  0 toggle @Override
129    public String getAnnotLabel()
130    {
131    // TODO Auto-generated method stub
132  0 return null;
133    }
134   
 
135  0 toggle @Override
136    public String getType()
137    {
138  0 return null;
139    }
140   
 
141  2142 toggle @Override
142    public int getWidth()
143    {
144  2142 return maxcol;
145    }
146   
 
147  103448 toggle @Override
148    public int getHeight()
149    {
150  103448 return maxrow;
151    }
152    }