import java.awt.Color;
/**
- * DOCUMENT ME!
+ * Represent a node in a binary tree
*
- * @author $author$
+ * @author $mclamp (probably!)$
* @version $Revision$
*/
-public class BinaryNode
+public class BinaryNode<T>
{
- Object element;
+ T element;
String name;
- BinaryNode left;
+ BinaryNode<T> left;
- BinaryNode right;
+ BinaryNode<T> right;
- BinaryNode parent;
+ BinaryNode<T> parent;
/** Bootstrap value */
public int bootstrap;
/** DOCUMENT ME!! */
public Color color = Color.black;
- /** DOCUMENT ME!! */
+ /** if true, node is created to simulate polytomy between parent and its 3 or more children */
public boolean dummy = false;
/**
* @param name
* DOCUMENT ME!
*/
- public BinaryNode(Object element, BinaryNode parent, String name,
+ public BinaryNode(T element, BinaryNode<T> parent, String name,
double dist)
{
this();
this.dist = dist;
}
- public BinaryNode(Object element, BinaryNode parent, String name,
+ public BinaryNode(T element, BinaryNode<T> 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,
+ public BinaryNode(T val, BinaryNode<T> parent, String name, double dist,
int bootstrap, boolean dummy)
{
this(val, parent, name, dist, bootstrap);
*
* @return DOCUMENT ME!
*/
- public Object element()
+ public T element()
{
return element;
}
*
* @return DOCUMENT ME!
*/
- public Object setElement(Object v)
+ public T setElement(T v)
{
return element = v;
}
*
* @return DOCUMENT ME!
*/
- public BinaryNode left()
+ public BinaryNode<T> left()
{
return left;
}
*
* @return DOCUMENT ME!
*/
- public BinaryNode setLeft(BinaryNode n)
+ public BinaryNode<T> setLeft(BinaryNode<T> n)
{
return left = n;
}
*
* @return DOCUMENT ME!
*/
- public BinaryNode right()
+ public BinaryNode<T> right()
{
return right;
}
*
* @return DOCUMENT ME!
*/
- public BinaryNode setRight(BinaryNode n)
+ public BinaryNode<T> setRight(BinaryNode<T> n)
{
return right = n;
}
*
* @return DOCUMENT ME!
*/
- public BinaryNode parent()
+ public BinaryNode<T> parent()
{
return parent;
}
*
* @return DOCUMENT ME!
*/
- public BinaryNode setParent(BinaryNode n)
+ public BinaryNode<T> setParent(BinaryNode<T> n)
{
return parent = n;
}
* setChild(null), or detach() for this.
*
*/
- public void SetChildren(BinaryNode leftchild, BinaryNode rightchild)
+ public void SetChildren(BinaryNode<T> leftchild, BinaryNode<T> rightchild)
{
if (leftchild != null)
{
*
* @return BinaryNode The detached node.
*/
- public BinaryNode detach()
+ public BinaryNode<T> detach()
{
if (this.parent != null)
{
*
* @return BinaryNode
*/
- public BinaryNode ascendLeft()
+ public BinaryNode<T> ascendLeft()
{
- BinaryNode c = this;
+ BinaryNode<T> c = this;
do
{
*
* @return BinaryNode
*/
- public BinaryNode ascendRight()
+ public BinaryNode<T> ascendRight()
{
- BinaryNode c = this;
+ BinaryNode<T> c = this;
do
{
* ascends the tree but doesn't stop until a non-dummy node is discovered.
*
*/
- public BinaryNode AscendTree()
+ public BinaryNode<T> AscendTree()
{
- BinaryNode c = this;
+ BinaryNode<T> c = this;
do
{
* @author $author$
* @version $Revision$
*/
-public class SequenceNode extends BinaryNode
+public class SequenceNode extends BinaryNode<SequenceI>
{
private boolean placeholder = false;
super();
}
- public SequenceNode(SequenceI val, BinaryNode parent, String name,
+ public SequenceNode(SequenceI val, BinaryNode<SequenceI> parent, String name,
double dist, int bootstrap, boolean dummy)
{
super(val, parent, name, dist, bootstrap, dummy);
}
- public SequenceNode(SequenceI element, BinaryNode parent, String name,
+ public SequenceNode(SequenceI element, BinaryNode<SequenceI> parent, String name,
double dist, int bootstrap)
{
super(element, parent, name, dist, bootstrap);
}
- public SequenceNode(SequenceI element, BinaryNode parent, String name,
+ public SequenceNode(SequenceI element, BinaryNode<SequenceI> parent, String name,
double dist)
{
super(element, parent, name, dist);