From e8ca34d6b969ecde379e9cc5c484fcdc4f057ff5 Mon Sep 17 00:00:00 2001 From: James Procter Date: Tue, 17 Oct 2023 17:25:28 +0100 Subject: [PATCH] JAL-4134 JAL-4302 remove unnecessary casts --- src/jalview/analysis/TreeModel.java | 4 ++-- src/jalview/gui/TreeCanvas.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/jalview/analysis/TreeModel.java b/src/jalview/analysis/TreeModel.java index 90fe089..59e4712 100644 --- a/src/jalview/analysis/TreeModel.java +++ b/src/jalview/analysis/TreeModel.java @@ -430,7 +430,7 @@ public class TreeModel if ((nd.left() == null) && (nd.right() == null)) { - nd.height = ((BinaryNode) nd.parent()).height + nd.dist; + nd.height = nd.parent().height + nd.dist; if (nd.height > maxheight) { @@ -445,7 +445,7 @@ public class TreeModel { if (nd.parent() != null) { - nd.height = ((BinaryNode) nd.parent()).height + nd.dist; + nd.height = nd.parent().height + nd.dist; } else { diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 6fbd422..2d4bdc8 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -406,9 +406,9 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } int ystart = (node.left() == null ? 0 - : (int) (((BinaryNode) node.left()).ycount * chunk)) + offy; + : (int) (node.left().ycount * chunk)) + offy; int yend = (node.right() == null ? 0 - : (int) (((BinaryNode) node.right()).ycount * chunk)) + offy; + : (int) (node.right().ycount * chunk)) + offy; Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5); nodeHash.put(node, pos); @@ -791,11 +791,11 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (top.count == 0) { - top.count = ((BinaryNode) top.left()).count - + ((BinaryNode) top.right()).count; + top.count = top.left().count + + top.right().count; } - double chunk = (double) (height - (offy)) / (double)top.count; + float chunk = (float) (height - (offy)) / top.count; drawNode(g2, tree.getTopNode(), chunk, wscale, width, offx, offy); -- 1.7.10.2