X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FBinaryNode.java;h=5b55594c75a541b6d8623727564ac4be71504941;hb=4b7d3640209c4434d569c746672cf9eed4250ace;hp=bfe8c04d3e1decdafc42fbcd55ab0288c05e74a0;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/datamodel/BinaryNode.java b/src/jalview/datamodel/BinaryNode.java index bfe8c04..5b55594 100755 --- a/src/jalview/datamodel/BinaryNode.java +++ b/src/jalview/datamodel/BinaryNode.java @@ -1,23 +1,27 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.datamodel; +import java.awt.Color; + /** * DOCUMENT ME! * @@ -36,9 +40,27 @@ public class BinaryNode BinaryNode parent; - /** DOCUMENT ME!! */ + /** Bootstrap value */ public int bootstrap; + /** DOCUMENT ME!! */ + public double dist; + + /** DOCUMENT ME!! */ + public int count; + + /** DOCUMENT ME!! */ + public double height; + + /** DOCUMENT ME!! */ + public float ycount; + + /** DOCUMENT ME!! */ + public Color color = Color.black; + + /** DOCUMENT ME!! */ + public boolean dummy = false; + /** * Creates a new BinaryNode object. */ @@ -46,25 +68,41 @@ public class BinaryNode { left = right = parent = null; bootstrap = 0; + dist = 0; } /** * Creates a new BinaryNode object. * * @param element - * DOCUMENT ME! + * DOCUMENT ME! * @param parent - * DOCUMENT ME! + * DOCUMENT ME! * @param name - * DOCUMENT ME! + * DOCUMENT ME! */ - public BinaryNode(Object element, BinaryNode parent, String name) + public BinaryNode(Object element, BinaryNode parent, String name, + double dist) { + this(); this.element = element; this.parent = parent; this.name = name; + this.dist = dist; + } - left = right = null; + public BinaryNode(Object element, BinaryNode parent, String name, + double dist, int bootstrap) + { + this(element, parent, name, dist); + this.bootstrap = bootstrap; + } + + public BinaryNode(Object val, BinaryNode parent, String name, double dist, + int bootstrap, boolean dummy) + { + this(val, parent, name, dist, bootstrap); + this.dummy = dummy; } /** @@ -81,7 +119,7 @@ public class BinaryNode * DOCUMENT ME! * * @param v - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -104,7 +142,7 @@ public class BinaryNode * DOCUMENT ME! * * @param n - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -127,7 +165,7 @@ public class BinaryNode * DOCUMENT ME! * * @param n - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -150,7 +188,7 @@ public class BinaryNode * DOCUMENT ME! * * @param n - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -260,7 +298,9 @@ public class BinaryNode /** * * set the display name - * @param new name + * + * @param new + * name */ public void setName(String name) { @@ -288,11 +328,53 @@ public class BinaryNode } /** - * get bootstrap + * get bootstrap + * * @return integer value */ public int getBootstrap() { return bootstrap; } + + /** + * @param dummy + * true if node is created for the representation of polytomous trees + */ + public boolean isDummy() + { + return dummy; + } + + /** + * DOCUMENT ME! + * + * @param newstate + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public boolean setDummy(boolean newstate) + { + boolean oldstate = dummy; + dummy = newstate; + + return oldstate; + } + + /** + * ascends the tree but doesn't stop until a non-dummy node is discovered. + * + */ + public BinaryNode AscendTree() + { + BinaryNode c = this; + + do + { + c = c.parent(); + } while ((c != null) && c.dummy); + + return c; + } }