git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4235 JAL-3599 Try and report Eclipse Product Version for jalviewjsTranspile....
[jalview.git]
/
src
/
jalview
/
analysis
/
TreeModel.java
diff --git
a/src/jalview/analysis/TreeModel.java
b/src/jalview/analysis/TreeModel.java
index
a50634e
..
0e57a58
100644
(file)
--- a/
src/jalview/analysis/TreeModel.java
+++ b/
src/jalview/analysis/TreeModel.java
@@
-50,7
+50,7
@@
public class TreeModel
int noseqs;
int noseqs;
- SequenceNode top;
+ BinaryNode top;
double maxDistValue;
double maxDistValue;
@@
-58,7
+58,7
@@
public class TreeModel
int ycount;
int ycount;
- Vector<SequenceNode> node;
+ Vector<BinaryNode> node;
boolean hasDistances = true; // normal case for jalview trees
boolean hasDistances = true; // normal case for jalview trees
@@
-108,7
+108,7
@@
public class TreeModel
* @param hasBoot
* @param hasRootDist
*/
* @param hasBoot
* @param hasRootDist
*/
- public TreeModel(SequenceI[] seqs, SequenceNode root, boolean hasDist,
+ public TreeModel(SequenceI[] seqs, BinaryNode root, boolean hasDist,
boolean hasBoot, boolean hasRootDist)
{
this.sequences = seqs;
boolean hasBoot, boolean hasRootDist)
{
this.sequences = seqs;
@@
-128,7
+128,7
@@
public class TreeModel
{
SequenceIdMatcher algnIds = new SequenceIdMatcher(seqs);
{
SequenceIdMatcher algnIds = new SequenceIdMatcher(seqs);
- Vector<SequenceNode> leaves = findLeaves(top);
+ Vector<BinaryNode> leaves = findLeaves(top);
int i = 0;
int namesleft = seqs.length;
int i = 0;
int namesleft = seqs.length;
@@
-140,7
+140,8
@@
public class TreeModel
// int countOne2Many = 0;
while (i < leaves.size())
{
// int countOne2Many = 0;
while (i < leaves.size())
{
- j = leaves.elementAt(i++);
+ // TODO - decide if we get rid of the polymorphism here ?
+ j = (SequenceNode) leaves.elementAt(i++);
realnam = j.getName();
nam = null;
realnam = j.getName();
nam = null;
@@
-155,8
+156,8
@@
public class TreeModel
if (one2many.contains(nam))
{
// countOne2Many++;
if (one2many.contains(nam))
{
// countOne2Many++;
- // if (jalview.bin.Cache.log.isDebugEnabled())
- // jalview.bin.Cache.log.debug("One 2 many relationship for
+ // if (Cache.isDebugEnabled())
+ // Cache.debug("One 2 many relationship for
// "+nam.getName());
}
else
// "+nam.getName());
}
else
@@
-171,8
+172,8
@@
public class TreeModel
j.setPlaceholder(true);
}
}
j.setPlaceholder(true);
}
}
- // if (jalview.bin.Cache.log.isDebugEnabled() && countOne2Many>0) {
- // jalview.bin.Cache.log.debug("There were "+countOne2Many+" alignment
+ // if (Cache.isDebugEnabled() && countOne2Many>0) {
+ // Cache.debug("There were "+countOne2Many+" alignment
// sequence ids (out of "+one2many.size()+" unique ids) linked to two or
// more leaves.");
// }
// sequence ids (out of "+one2many.size()+" unique ids) linked to two or
// more leaves.");
// }
@@
-205,7
+206,7
@@
public class TreeModel
*/
public void updatePlaceHolders(List<SequenceI> list)
{
*/
public void updatePlaceHolders(List<SequenceI> list)
{
- Vector<SequenceNode> leaves = findLeaves(top);
+ Vector<BinaryNode> leaves = findLeaves(top);
int sz = leaves.size();
SequenceIdMatcher seqmatcher = null;
int sz = leaves.size();
SequenceIdMatcher seqmatcher = null;
@@
-213,7
+214,7
@@
public class TreeModel
while (i < sz)
{
while (i < sz)
{
- SequenceNode leaf = leaves.elementAt(i++);
+ SequenceNode leaf = (SequenceNode) leaves.elementAt(i++);
if (list.contains(leaf.element()))
{
if (list.contains(leaf.element()))
{
@@
-288,15
+289,15
@@
public class TreeModel
/**
* Search for leaf nodes below (or at) the given node
*
/**
* Search for leaf nodes below (or at) the given node
*
- * @param nd
+ * @param top2
* root node to search from
*
* @return
*/
* root node to search from
*
* @return
*/
- public Vector<SequenceNode> findLeaves(SequenceNode nd)
+ public Vector<BinaryNode> findLeaves(BinaryNode top2)
{
{
- Vector<SequenceNode> leaves = new Vector<SequenceNode>();
- findLeaves(nd, leaves);
+ Vector<BinaryNode> leaves = new Vector<BinaryNode>();
+ findLeaves(top2, leaves);
return leaves;
}
return leaves;
}
@@
-310,8
+311,7
@@
public class TreeModel
*
* @return Vector of leaf nodes on binary tree
*/
*
* @return Vector of leaf nodes on binary tree
*/
- Vector<SequenceNode> findLeaves(SequenceNode nd,
- Vector<SequenceNode> leaves)
+ Vector<BinaryNode> findLeaves(BinaryNode nd, Vector<BinaryNode> leaves)
{
if (nd == null)
{
{
if (nd == null)
{
@@
-331,8
+331,8
@@
public class TreeModel
* TODO: Identify internal nodes... if (node.isSequenceLabel()) {
* leaves.addElement(node); }
*/
* TODO: Identify internal nodes... if (node.isSequenceLabel()) {
* leaves.addElement(node); }
*/
- findLeaves((SequenceNode) nd.left(), leaves);
- findLeaves((SequenceNode) nd.right(), leaves);
+ findLeaves(nd.left(), leaves);
+ findLeaves(nd.right(), leaves);
}
return leaves;
}
return leaves;
@@
-344,7
+344,7
@@
public class TreeModel
* @param nd
* SequenceNode
*/
* @param nd
* SequenceNode
*/
- void printNode(SequenceNode nd)
+ void printNode(BinaryNode nd)
{
if (nd == null)
{
{
if (nd == null)
{
@@
-360,8
+360,8
@@
public class TreeModel
else
{
System.out.println("Dist " + nd.dist);
else
{
System.out.println("Dist " + nd.dist);
- printNode((SequenceNode) nd.left());
- printNode((SequenceNode) nd.right());
+ printNode((BinaryNode) nd.left());
+ printNode((BinaryNode) nd.right());
}
}
}
}
@@
-387,14
+387,14
@@
public class TreeModel
* @param threshold
* @see #getGroups()
*/
* @param threshold
* @see #getGroups()
*/
- public List<SequenceNode> groupNodes(float threshold)
+ public List<BinaryNode> groupNodes(float threshold)
{
{
- List<SequenceNode> groups = new ArrayList<SequenceNode>();
+ List<BinaryNode> groups = new ArrayList<BinaryNode>();
_groupNodes(groups, getTopNode(), threshold);
return groups;
}
_groupNodes(groups, getTopNode(), threshold);
return groups;
}
- protected void _groupNodes(List<SequenceNode> groups, SequenceNode nd,
+ protected void _groupNodes(List<BinaryNode> groups, BinaryNode nd,
float threshold)
{
if (nd == null)
float threshold)
{
if (nd == null)
@@
-408,8
+408,8
@@
public class TreeModel
}
else
{
}
else
{
- _groupNodes(groups, (SequenceNode) nd.left(), threshold);
- _groupNodes(groups, (SequenceNode) nd.right(), threshold);
+ _groupNodes(groups, nd.left(), threshold);
+ _groupNodes(groups, nd.right(), threshold);
}
}
}
}
@@
-421,7
+421,7
@@
public class TreeModel
*
* @return DOCUMENT ME!
*/
*
* @return DOCUMENT ME!
*/
- public double findHeight(SequenceNode nd)
+ public double findHeight(BinaryNode nd)
{
if (nd == null)
{
{
if (nd == null)
{
@@
-430,7
+430,7
@@
public class TreeModel
if ((nd.left() == null) && (nd.right() == null))
{
if ((nd.left() == null) && (nd.right() == null))
{
- nd.height = ((SequenceNode) nd.parent()).height + nd.dist;
+ nd.height = ((BinaryNode) nd.parent()).height + nd.dist;
if (nd.height > maxheight)
{
if (nd.height > maxheight)
{
@@
-445,7
+445,7
@@
public class TreeModel
{
if (nd.parent() != null)
{
{
if (nd.parent() != null)
{
- nd.height = ((SequenceNode) nd.parent()).height + nd.dist;
+ nd.height = ((BinaryNode) nd.parent()).height + nd.dist;
}
else
{
}
else
{
@@
-453,8
+453,8
@@
public class TreeModel
nd.height = (float) 0.0;
}
nd.height = (float) 0.0;
}
- maxheight = findHeight((SequenceNode) (nd.left()));
- maxheight = findHeight((SequenceNode) (nd.right()));
+ maxheight = findHeight((BinaryNode) (nd.left()));
+ maxheight = findHeight((BinaryNode) (nd.right()));
}
return maxheight;
}
return maxheight;
@@
-466,7
+466,7
@@
public class TreeModel
* @param nd
* DOCUMENT ME!
*/
* @param nd
* DOCUMENT ME!
*/
- void printN(SequenceNode nd)
+ void printN(BinaryNode nd)
{
if (nd == null)
{
{
if (nd == null)
{
@@
-475,8
+475,8
@@
public class TreeModel
if ((nd.left() != null) && (nd.right() != null))
{
if ((nd.left() != null) && (nd.right() != null))
{
- printN((SequenceNode) nd.left());
- printN((SequenceNode) nd.right());
+ printN((BinaryNode) nd.left());
+ printN((BinaryNode) nd.right());
}
else
{
}
else
{
@@
-493,7
+493,7
@@
public class TreeModel
* @param nd
* DOCUMENT ME!
*/
* @param nd
* DOCUMENT ME!
*/
- public void reCount(SequenceNode nd)
+ public void reCount(BinaryNode nd)
{
ycount = 0;
// _lycount = 0;
{
ycount = 0;
// _lycount = 0;
@@
-509,7
+509,7
@@
public class TreeModel
* @param nd
* DOCUMENT ME!
*/
* @param nd
* DOCUMENT ME!
*/
- void _reCount(SequenceNode nd)
+ void _reCount(BinaryNode nd)
{
// if (_lycount<_lylimit)
// {
{
// if (_lycount<_lylimit)
// {
@@
-525,11
+525,11
@@
public class TreeModel
if ((nd.left() != null) && (nd.right() != null))
{
if ((nd.left() != null) && (nd.right() != null))
{
- _reCount((SequenceNode) nd.left());
- _reCount((SequenceNode) nd.right());
+ _reCount((BinaryNode) nd.left());
+ _reCount((BinaryNode) nd.right());
- SequenceNode l = (SequenceNode) nd.left();
- SequenceNode r = (SequenceNode) nd.right();
+ BinaryNode l = (BinaryNode) nd.left();
+ BinaryNode r = (BinaryNode) nd.right();
nd.count = l.count + r.count;
nd.ycount = (l.ycount + r.ycount) / 2;
nd.count = l.count + r.count;
nd.ycount = (l.ycount + r.ycount) / 2;
@@
-548,14
+548,14
@@
public class TreeModel
* @param nd
* DOCUMENT ME!
*/
* @param nd
* DOCUMENT ME!
*/
- public void swapNodes(SequenceNode nd)
+ public void swapNodes(BinaryNode nd)
{
if (nd == null)
{
return;
}
{
if (nd == null)
{
return;
}
- SequenceNode tmp = (SequenceNode) nd.left();
+ BinaryNode tmp = (BinaryNode) nd.left();
nd.setLeft(nd.right());
nd.setRight(tmp);
nd.setLeft(nd.right());
nd.setRight(tmp);
@@
-569,7
+569,7
@@
public class TreeModel
* @param dir
* DOCUMENT ME!
*/
* @param dir
* DOCUMENT ME!
*/
- void changeDirection(SequenceNode nd, SequenceNode dir)
+ void changeDirection(BinaryNode nd, BinaryNode dir)
{
if (nd == null)
{
{
if (nd == null)
{
@@
-578,9
+578,9
@@
public class TreeModel
if (nd.parent() != top)
{
if (nd.parent() != top)
{
- changeDirection((SequenceNode) nd.parent(), nd);
+ changeDirection((BinaryNode) nd.parent(), nd);
- SequenceNode tmp = (SequenceNode) nd.parent();
+ BinaryNode tmp = (BinaryNode) nd.parent();
if (dir == nd.left())
{
if (dir == nd.left())
{
@@
-629,7
+629,7
@@
public class TreeModel
*
* @return DOCUMENT ME!
*/
*
* @return DOCUMENT ME!
*/
- public SequenceNode getTopNode()
+ public BinaryNode getTopNode()
{
return top;
}
{
return top;
}
@@
-664,7
+664,7
@@
public class TreeModel
*/
public void applyToNodes(NodeTransformI nodeTransformI)
{
*/
public void applyToNodes(NodeTransformI nodeTransformI)
{
- for (Enumeration<SequenceNode> nodes = node.elements(); nodes
+ for (Enumeration<BinaryNode> nodes = node.elements(); nodes
.hasMoreElements(); nodeTransformI
.transform(nodes.nextElement()))
{
.hasMoreElements(); nodeTransformI
.transform(nodes.nextElement()))
{