forester.datastructures
Class BasketDataStructure
java.lang.Object
|
+--forester.datastructures.BasketDataStructure
- public class BasketDataStructure
- extends java.lang.Object
- Version:
- 1.000 -- last modified: 10/12/00
- Author:
- Christian M. Zmasek
Method Summary |
void |
createBasket(int g,
int s)
Creates a basket( s ), which is affiliated with the Node s
of the species Tree and which contains the Node g of the gene Tree. |
int |
findBasket(int g)
Finds the basket containing the Node g of the gene Tree. |
void |
insertIntoBasket(int g,
int s)
Inserts gene Tree Node g into basket( s ). |
void |
mergeBasket(int s1,
int s2)
Adds the elements of basket( s1 ) to the elements of
basket( s2 ) and deletes basket( s1 )
(Corresponds to method link of DisjointSet.) |
void |
moveBasket(int s1,
int s2)
Changes the affiliation of basket( s1 ) from s1 to s2. |
java.lang.String |
toString()
Transfers this to a String; |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BasketDataStructure
public BasketDataStructure(int s)
- Constructs a BasketDataStructure of size s.
- Parameters:
s
- initial size (int)
createBasket
public void createBasket(int g,
int s)
- Creates a basket( s ), which is affiliated with the Node s
of the species Tree and which contains the Node g of the gene Tree.
(Corresponds to method makeSet of DisjointSet.)
- Parameters:
g
- a Node ID of the gene Tree (int)s
- a Node ID of the species Tree which will become
the representative of a basket (int)
moveBasket
public void moveBasket(int s1,
int s2)
- Changes the affiliation of basket( s1 ) from s1 to s2.
- Parameters:
s1
- a Node ID of the species Tree
and representative of a existing basket( s1 ) (int)s2
- a Node ID of the species Tree (int)
mergeBasket
public void mergeBasket(int s1,
int s2)
- Adds the elements of basket( s1 ) to the elements of
basket( s2 ) and deletes basket( s1 )
(Corresponds to method link of DisjointSet.)
- Parameters:
s1
- a Node ID of the species Tree
and representative of a existing basket( s1 ) (int)s2
- a Node ID of the species Tree
and representative of a existing basket( s2 ) (int)
findBasket
public int findBasket(int g)
- Finds the basket containing the Node g of the gene Tree.
(Corresponds to method findSet of DisjointSet.)
- Parameters:
g
- a Node ID of the gene Tree (int)- Returns:
- the representative of the basket containing gene Tree node g
insertIntoBasket
public void insertIntoBasket(int g,
int s)
- Inserts gene Tree Node g into basket( s ).
- Parameters:
g
- a Node ID of the gene Tree (int)s
- a Node ID of the species Tree
and representative of a existing basket( s1 ) (int)
toString
public java.lang.String toString()
- Transfers this to a String;
- Overrides:
toString
in class java.lang.Object