Clover icon

jalviewX

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

File SequenceNode.java

 

Coverage histogram

../../img/srcFileCovDistChart5.png
40% of files have more coverage

Code metrics

8
24
9
1
189
73
16
0.67
2.67
9
1.78

Classes

Class Line # Actions
SequenceNode 31 24 16 22
0.4634146446.3%
 

Contributing tests

This file is covered by 10 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    import java.awt.Color;
24   
25    /**
26    * DOCUMENT ME!
27    *
28    * @author $author$
29    * @version $Revision$
30    */
 
31    public class SequenceNode extends BinaryNode
32    {
33    /** DOCUMENT ME!! */
34    public double dist;
35   
36    /** DOCUMENT ME!! */
37    public int count;
38   
39    /** DOCUMENT ME!! */
40    public double height;
41   
42    /** DOCUMENT ME!! */
43    public float ycount;
44   
45    /** DOCUMENT ME!! */
46    public Color color = Color.black;
47   
48    /** DOCUMENT ME!! */
49    public boolean dummy = false;
50   
51    private boolean placeholder = false;
52   
53    /**
54    * Creates a new SequenceNode object.
55    */
 
56  18 toggle public SequenceNode()
57    {
58  18 super();
59    }
60   
61    /**
62    * Creates a new SequenceNode object.
63    *
64    * @param val
65    * DOCUMENT ME!
66    * @param parent
67    * DOCUMENT ME!
68    * @param dist
69    * DOCUMENT ME!
70    * @param name
71    * DOCUMENT ME!
72    */
 
73  0 toggle public SequenceNode(Object val, SequenceNode parent, float dist,
74    String name)
75    {
76  0 super(val, parent, name);
77  0 this.dist = dist;
78    }
79   
80    /**
81    * Creates a new SequenceNode object.
82    *
83    * @param val
84    * DOCUMENT ME!
85    * @param parent
86    * DOCUMENT ME!
87    * @param name
88    * DOCUMENT ME!
89    * @param dist
90    * DOCUMENT ME!
91    * @param bootstrap
92    * DOCUMENT ME!
93    * @param dummy
94    * DOCUMENT ME!
95    */
 
96  298 toggle public SequenceNode(Object val, SequenceNode parent, String name,
97    float dist, int bootstrap, boolean dummy)
98    {
99  298 super(val, parent, name);
100  298 this.dist = dist;
101  298 this.bootstrap = bootstrap;
102  298 this.dummy = dummy;
103    }
104   
105    /**
106    * @param dummy
107    * true if node is created for the representation of polytomous trees
108    */
 
109  34 toggle public boolean isDummy()
110    {
111  34 return dummy;
112    }
113   
114    /*
115    * @param placeholder is true if the sequence refered to in the element node
116    * is not actually present in the associated alignment
117    */
 
118  370 toggle public boolean isPlaceholder()
119    {
120  370 return placeholder;
121    }
122   
123    /**
124    * DOCUMENT ME!
125    *
126    * @param newstate
127    * DOCUMENT ME!
128    *
129    * @return DOCUMENT ME!
130    */
 
131  0 toggle public boolean setDummy(boolean newstate)
132    {
133  0 boolean oldstate = dummy;
134  0 dummy = newstate;
135   
136  0 return oldstate;
137    }
138   
139    /**
140    * DOCUMENT ME!
141    *
142    * @param Placeholder
143    * DOCUMENT ME!
144    */
 
145  38 toggle public void setPlaceholder(boolean Placeholder)
146    {
147  38 this.placeholder = Placeholder;
148    }
149   
150    /**
151    * ascends the tree but doesn't stop until a non-dummy node is discovered.
152    * This will probably break if the tree is a mixture of BinaryNodes and
153    * SequenceNodes.
154    */
 
155  140 toggle public SequenceNode AscendTree()
156    {
157  140 SequenceNode c = this;
158   
159  140 do
160    {
161  140 c = (SequenceNode) c.parent();
162  140 } while ((c != null) && c.dummy);
163   
164  140 return c;
165    }
166   
167    /**
168    * test if this node has a name that might be a label rather than a bootstrap
169    * value
170    *
171    * @return true if node has a non-numeric label
172    */
 
173  0 toggle public boolean isSequenceLabel()
174    {
175  0 if (name != null && name.length() > 0)
176    {
177  0 for (int c = 0, s = name.length(); c < s; c++)
178    {
179  0 char q = name.charAt(c);
180  0 if ('0' <= q && q <= '9')
181    {
182  0 continue;
183    }
184  0 return true;
185    }
186    }
187  0 return false;
188    }
189    }