|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.olduvai.treejuxtaposer.TreeParser
public class TreeParser
Field Summary | |
---|---|
private static java.lang.String |
beginTag
Begin tag. |
private static char |
commentClose
Nexus comment close. |
private static char |
commentOpen
Nexus comment open. |
private static boolean |
debugOutput
True: show debug output. |
private static java.lang.String |
endTag
End tag. |
private static char |
equals
Equality sign. |
private javax.swing.JProgressBar |
jpb
Progress bar. |
private static char |
lineTerminator
Line (and tree information) termination. |
private static java.lang.String |
nexusFileID
Nexus file identifier. |
private java.util.Vector |
returnVector
For returning results inside action listeners. |
private TreeNode |
rootNode
Root node of the tree being parsed. |
private javax.swing.JList |
selection
For listing the selected results from the list of Nexus tree names. |
private javax.swing.JFrame |
selectionFrame
Frame for selecting Nexus trees from the full set. |
private java.io.StreamTokenizer |
tokenizer
|
private static java.lang.String |
treeID
Tree ID. |
private static java.lang.String |
treeSectionTag
Tree section. |
private static java.lang.String |
utreeID
Tree ID (same or similar to treeID ?). |
Constructor Summary | |
---|---|
TreeParser(java.io.BufferedReader b)
Initializes parsing of a tree by creating a tokenizer and setting default properties (such as spacing, quoting characters). |
Method Summary | |
---|---|
java.util.Vector |
chooseNames(java.util.ArrayList treeNames)
Pops a dialog to select the trees to load from a nexus file. |
void |
debugOutput(java.lang.String s)
Debug printout function. |
javax.swing.JProgressBar |
getProgressBar()
Get the progress bar object. |
private void |
initNexusChooser()
Layout and listeners for the nexus chooser. |
boolean |
isNexusFile(java.lang.String fileName)
Guess the type of treeFile based on the presence of nexus identifiers. |
static void |
main(java.lang.String[] args)
Test application function. |
private void |
nexusCharacterTokenize()
Tokenize the character section of a nexus file only. |
static java.util.ArrayList |
nexusFileTreeNames(java.lang.String fileName)
Parses names of trees in nexus file. |
private void |
nexusTaxaTokenize()
Nexus taxa tokenizer, does nothing for now, but can be used later. |
java.util.ArrayList |
nexusTokenize(java.util.Vector treeNumbers,
javax.swing.JProgressBar progressBar)
Tokenize a nexus file, uses newick tokenizer after identifying the region with the tree information. |
private java.util.ArrayList |
nexusTreeTokenize(java.util.Vector treeNumbers)
Tokenize the tree section of a nexus file only, uses newick tokenizer. |
private TreeNode |
popAndName(java.lang.String name,
java.util.Stack nodeStack)
Adds node at the top of the stack to the tree. |
Tree |
tokenize(long fileLength,
java.lang.String streamName,
javax.swing.JProgressBar progressBar)
Newick tokenizer: converts a string (tree as a string) into a tree object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String nexusFileID
private static final java.lang.String beginTag
private static final java.lang.String endTag
private static final java.lang.String treeSectionTag
private static final java.lang.String treeID
private static final java.lang.String utreeID
treeID
?).
private static final char lineTerminator
private static final char equals
private static final char commentOpen
private static final char commentClose
private static boolean debugOutput
private java.io.StreamTokenizer tokenizer
private TreeNode rootNode
private javax.swing.JProgressBar jpb
private javax.swing.JList selection
private java.util.Vector returnVector
private javax.swing.JFrame selectionFrame
Constructor Detail |
---|
public TreeParser(java.io.BufferedReader b)
tokenize(long, String, JProgressBar)
is required to start the parsing.
b
- Buffered reader that could start in the middle of a nexus file or
the start of a newick file (basically the beginning of a newick tree, is run
for each tree in a nexus file)Method Detail |
---|
public javax.swing.JProgressBar getProgressBar()
public boolean isNexusFile(java.lang.String fileName)
fileName
- The name of the file.
public static java.util.ArrayList nexusFileTreeNames(java.lang.String fileName)
fileName
- Name of nexus file.
private void initNexusChooser()
returnVector
.
public java.util.Vector chooseNames(java.util.ArrayList treeNames)
initNexusChooser()
dialog.
treeNames
- arraylist of tree names.
public void debugOutput(java.lang.String s)
debugOutput
depending on debugging or not.
s
- Display the string, for debugging.private TreeNode popAndName(java.lang.String name, java.util.Stack nodeStack)
name
- Name of the node.nodeStack
- Stack of nodes that haven't been added to the tree yet. Nodes are popped when
they have names and all children are processed.
public Tree tokenize(long fileLength, java.lang.String streamName, javax.swing.JProgressBar progressBar)
fileLength
- Length of the file, for progress bar movements.
For nexus files, this would be the relative position of the next semicolon = the size of the tree in bytes.streamName
- Name of the tree or file that is being loaded. Nexus files have names ("tree progressBar
- Reference to a progress bar widgit, embedded perhaps in place of the new canvas for this tree. If this is null, create a new progress bar here.
private void nexusTaxaTokenize()
private java.util.ArrayList nexusTreeTokenize(java.util.Vector treeNumbers)
treeNumbers
- Vector of Integers for commandline-based input of nexus trees; assume this vector is in ascending order
private void nexusCharacterTokenize()
public java.util.ArrayList nexusTokenize(java.util.Vector treeNumbers, javax.swing.JProgressBar progressBar)
treeNumbers
- Vector of Integers for commandline-based input of nexus trees; assume this vector is in ascending order.
public static void main(java.lang.String[] args)
args
- Program arguments. Only first argument used (for filename).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |