phylonet.network.model
Interface NetNode<T>

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
BniNetNode

public interface NetNode<T>
extends java.io.Serializable

This interface defines basic methods that a network node must implement.

Author:
Cuong Than and Derek Ruths May 27, 06: Created

Field Summary
static double NO_DISTANCE
           
static java.lang.String NO_NAME
           
 
Method Summary
 void addGamma(double gamma)
          This function adds the gamma value stored in this node.
 boolean adoptChild(NetNode<T> child, double distance)
          This function connects an existing node (the node that makes a call to this function) to another node child.
 boolean adoptChild(NetNode<T> child, double distance, double gamma)
          This function connects an existing node (the node that makes a call to this function) to another node child.
 java.lang.Iterable<NetNode<T>> getChildren()
           
 T getData()
           
 double getGamma(int index)
          This function returns the gamma value stored in this node.
 double getGamma(NetNode<T> child)
          This function returns the gamma value stored in this node.
 int getIndeg()
           
 java.lang.String getName()
           
 int getOutdeg()
           
 double getParentDistance(NetNode<T> parent)
           
 int getParentNumber()
          This function returns the number of parent of a node.
 java.lang.Iterable<NetNode<T>> getParents()
           
 boolean isLeaf()
           
 boolean isNetworkNode()
           
 boolean isRoot()
           
 boolean isTreeNode()
           
 boolean removeChild(NetNode<T> child)
          This function makes child no longer a child of this node.
 void setData(T data)
          This function updates data stored in this node.
 void setGamma(int index, double gamma)
          This function updates the gamma value stored in this node.
 void setName(java.lang.String name)
          This function changes the name of an existing node.
 boolean setParentDistance(NetNode<T> parent, double distance)
          This functions sets the distance from this calling node to parent with the new value newDistance.
 

Field Detail

NO_DISTANCE

static final double NO_DISTANCE
See Also:
Constant Field Values

NO_NAME

static final java.lang.String NO_NAME
See Also:
Constant Field Values
Method Detail

getChildren

java.lang.Iterable<NetNode<T>> getChildren()
Returns:
an iterable list of children of the node invoking this method.

isRoot

boolean isRoot()
Returns:
true if the node is the root of the network.

isLeaf

boolean isLeaf()
Returns:
true if the node is a leaf; false otherwise.

isTreeNode

boolean isTreeNode()
Returns:
true if this node is a tree node, i.e. it has only one parent.

isNetworkNode

boolean isNetworkNode()
Returns:
true if this node is a network node, i.e. it has more than one parent.

getParents

java.lang.Iterable<NetNode<T>> getParents()
Returns:
an iterable list of parents of the node invoking this method.

getParentDistance

double getParentDistance(NetNode<T> parent)
Parameters:
parent: - The parent of this node.
Returns:
the distance from this node to parent; NaN if parent is not in the list of parents of this node.

getIndeg

int getIndeg()
Returns:
in-degree of a node, which equals to the number of parents of this node.

getOutdeg

int getOutdeg()
Returns:
osut-degree of a node, which equals to the number of children of this node.

getName

java.lang.String getName()
Returns:
the name of this node.

getData

T getData()
Returns:
data stored in this node.

adoptChild

boolean adoptChild(NetNode<T> child,
                   double distance)
This function connects an existing node (the node that makes a call to this function) to another node child. The calling code will add child to its list of children if child has not been already a child of the calling node.

Parameters:
child: - The node that the calling node wants to connects to.
distance: - The distance between the calling code and child.
Returns:
true if this function succeeded; false otherwise.

adoptChild

boolean adoptChild(NetNode<T> child,
                   double distance,
                   double gamma)
This function connects an existing node (the node that makes a call to this function) to another node child. The calling code will add child to its list of children if child has not been already a child of the calling node.

Parameters:
child: - The node that the calling node wants to connects to.
distance: - The distance between the calling code and child.
gamma: - The alleles proportion.
Returns:
true if this function succeeded; false otherwise.

removeChild

boolean removeChild(NetNode<T> child)
This function makes child no longer a child of this node.

Parameters:
child: - The node to be removed.

setName

void setName(java.lang.String name)
This function changes the name of an existing node.

Parameters:
name: - The new name for the calling node.

setData

void setData(T data)
This function updates data stored in this node.

Parameters:
data - is the new data.

setParentDistance

boolean setParentDistance(NetNode<T> parent,
                          double distance)
This functions sets the distance from this calling node to parent with the new value newDistance.

Parameters:
parent: - A parent of this node that it wants to modify the distance.
distance: - New value for the distance from this node to parent.

addGamma

void addGamma(double gamma)
This function adds the gamma value stored in this node.

Parameters:
gamma - is the new gamma.

setGamma

void setGamma(int index,
              double gamma)
This function updates the gamma value stored in this node.

Parameters:
gamma - is the new gamma.

getGamma

double getGamma(int index)
This function returns the gamma value stored in this node.


getGamma

double getGamma(NetNode<T> child)
This function returns the gamma value stored in this node.


getParentNumber

int getParentNumber()
This function returns the number of parent of a node.