|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Algorithm
This class is an abstract class and defines the methods common to all algorithms.
Field Summary | |
protected javax.swing.JTextField |
ansField
The answer area for the users to type |
protected javax.swing.JFrame |
ansFrame
The answer window |
protected javax.swing.JLabel |
ansLabel
The field to hold answers |
protected java.lang.String |
answer
The answer of the question |
protected int |
count
The number of species |
protected boolean |
display
The value indicates whether the last step of MP and FM |
protected javax.swing.JTextArea |
infoArea
The instruction area to display information |
protected MyJTable |
inputTable
The input table in the algorithms |
protected int |
interNode
The interior node name |
protected MyJTable |
interTable
The intermediate result table in the algorithms |
protected double |
maxLength
The maximum branch length in the final trees |
protected java.lang.String |
maxName
The longest name of species |
protected int |
mini
The row index of the node to be joined |
protected int |
minj
The column index of the node to be joined |
protected double |
minLength
The minimum branch length in the final trees |
protected java.lang.String[] |
names
The names of species |
protected Node[] |
nodes
The nodes created in the trees |
protected int |
numOfNodes
The number of nodes created so far |
protected int |
numOfNodesLeft
The number of nodes left in the each step of the algorithms |
protected javax.swing.JButton |
okAnsButton
The OK button used in answer window |
protected javax.swing.JButton |
okQuesButton
The OK buttion used in question window |
protected PTCControls |
phyTreesControls
The control of PTC package |
protected boolean |
popUpQues
The value indicates whether the pop up question is enabled |
protected javax.swing.JFrame |
quesFrame
The question window |
protected javax.swing.JLabel |
quesLabel
The field to hold pop up questions |
protected java.lang.String |
question
The question itself |
protected int |
random_i
The random row value used in pop up questions |
protected int |
random_j
The random column value used in pop up questions |
protected java.util.Vector |
roots
The roots of the trees |
protected int |
runType
The algorithm run mode |
protected TreeDisplay |
treeDisplay
The object to draw the trees |
Constructor Summary | |
Algorithm(PTCControls inPhyTreesControls)
Initializes the GUI components used in all algorithms and constructs the question and the answer windows. |
Method Summary | |
abstract void |
calculateNewDistance()
The abstract method of the algorithm. |
void |
computeMaxName()
Computes the longest name of the species. |
void |
computeMinMaxLength()
Computes the longest and shortest branch lengths. |
void |
constructAnsFrame()
Constructs the answer window. |
javax.swing.JButton |
constructButton(java.lang.String name)
Constructs the buttons used in the window. |
void |
constructQuesFrame()
Constructs the question window. |
void |
deleteNodes()
Kills the nodes joined together in the each step of the algorithms. |
double |
findMin(double[][] table)
Finds the smallest value for a matrix. |
abstract boolean |
findOne()
The abstract method of the algorithm. |
int |
getCount()
Gets the number of species. |
boolean |
getDisplay()
The method indicates whether the last step of MP and FM. |
int |
getInterNode()
Gets the interior node name. |
double |
getMaxLength()
Gets the longest branch length in the trees. |
java.lang.String |
getMaxName()
Gets the longest name of the species. |
double |
getMinLength()
Gets the shortest branch length in the trees. |
java.lang.String[] |
getNames()
Gets the name of the species. |
Node |
getNode(int index)
Gets the node at specified index. |
Node[] |
getNodes()
Gets the nodes created so far. |
int |
getNumOfNodes()
Gets the number of nodes created so far. |
int |
getNumOfNodesLeft()
Gets the number of nodes left to join in the trees. |
java.util.Vector |
getRoots()
Gets the roots of the trees. |
boolean |
init()
Initalizes the components used in the algorithms. |
abstract boolean |
isEnd()
The abstract method of the algorithm. |
int |
randomInt(int seed)
Generates a random integer value. |
void |
reset()
Closes the question and answer windows. |
abstract void |
run()
The abstract method of the algorithm. |
void |
setPopUpQues(boolean inPopUpQues)
Sets the pop up question flag. |
void |
setRoots(java.util.Vector inRoots)
Sets the roots of the trees. |
void |
setRunType(int inRunType)
Sets the algorithm run mode. |
double |
setThreeFractionDigit(double value)
Formats a double value with threee fraction digits. |
abstract void |
trace()
The abstract method of the algorithm. |
void |
updateTree()
Updates the tree status in the each step of the algorithm running. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.awt.event.ActionListener |
actionPerformed |
Field Detail |
protected int runType
protected int count
protected int numOfNodes
protected int numOfNodesLeft
protected int mini
protected int minj
protected int interNode
protected java.lang.String[] names
protected boolean display
protected java.lang.String maxName
protected double maxLength
protected double minLength
protected Node[] nodes
protected java.util.Vector roots
protected javax.swing.JTextArea infoArea
protected MyJTable interTable
protected MyJTable inputTable
protected TreeDisplay treeDisplay
protected PTCControls phyTreesControls
protected boolean popUpQues
protected java.lang.String answer
protected java.lang.String question
protected int random_i
protected int random_j
protected javax.swing.JButton okQuesButton
protected javax.swing.JTextField ansField
protected javax.swing.JLabel quesLabel
protected javax.swing.JFrame quesFrame
protected javax.swing.JButton okAnsButton
protected javax.swing.JLabel ansLabel
protected javax.swing.JFrame ansFrame
Constructor Detail |
public Algorithm(PTCControls inPhyTreesControls)
inPhyTreesControls
- the PTCControls objectMethod Detail |
public abstract void run()
public abstract void trace()
public abstract void calculateNewDistance()
public abstract boolean isEnd()
public abstract boolean findOne()
public int getCount()
public int getNumOfNodesLeft()
public int getInterNode()
public Node[] getNodes()
public int getNumOfNodes()
public java.lang.String[] getNames()
public Node getNode(int index)
public java.util.Vector getRoots()
public double getMaxLength()
public double getMinLength()
public boolean getDisplay()
true
- it is the last step of MP and FM
false
- it is not the last step of MP and FMpublic java.lang.String getMaxName()
public void setRoots(java.util.Vector inRoots)
inRoots
- the roots of the treespublic void setPopUpQues(boolean inPopUpQues)
inPopUpQues
- the flag of pop up questionspublic void setRunType(int inRunType)
inRunType
- the algorrithm run modepublic boolean init()
true
- the algorithm is properly initialized
false
- input data is not rightpublic void reset()
public double setThreeFractionDigit(double value)
value
- a double value
public void computeMaxName()
public void updateTree()
public void computeMinMaxLength()
public double findMin(double[][] table)
table
- the matrix
public void deleteNodes()
public int randomInt(int seed)
seed
- the seed in each generation
public void constructQuesFrame()
public void constructAnsFrame()
public javax.swing.JButton constructButton(java.lang.String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |