/* * Jalview - A Sequence Alignment Editor and Viewer * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * 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 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. * * 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 */ package jalview.datamodel; import java.awt.*; public class SequenceNode extends BinaryNode { public float dist; public int count; public float height; public float ycount; public Color color = Color.black; public boolean dummy = false; private boolean placeholder = false; public SequenceNode() { super(); } public SequenceNode(Object val, SequenceNode parent, float dist, String name) { super(val, parent, name); this.dist = dist; } public SequenceNode(Object val, SequenceNode parent, String name, float dist, int bootstrap, boolean dummy) { super(val, parent, name); this.dist = dist; this.bootstrap = bootstrap; this.dummy = dummy; } /** * @param dummy true if node is created for the representation of polytomous trees */ public boolean isDummy() { return dummy; } /* @param placeholder is true if the sequence refered to in the * element node is not actually present in the associated alignment */ public boolean isPlaceholder() { return placeholder; } public boolean setDummy(boolean newstate) { boolean oldstate = dummy; dummy = newstate; return oldstate; } public void setPlaceholder(boolean Placeholder) { this.placeholder = Placeholder; } /** * ascends the tree but doesn't stop until a non-dummy node is discovered. * This will probably break if the tree is a mixture of BinaryNodes and SequenceNodes. */ public SequenceNode AscendTree() { SequenceNode c = this; do { c = (SequenceNode) c.parent(); } while ((c != null) && c.dummy); return c; } }