|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.bioinfweb.treegraph.document.io.nexus.NexusParser
public class NexusParser
| Field Summary | |
|---|---|
static Pattern |
BLOCK_BEGIN_PATTERN
|
static Pattern |
BLOCK_END_PATTERN
|
static Pattern |
COMMAND_PATTERN
|
static char |
COMMAND_SEPARATOR
|
static char |
COMMENT_END
|
static char |
COMMENT_START
|
static Pattern |
EMPTY_PATTERN
|
static Pattern |
ENCLOSED_NAME_PATTERN
|
static String |
NAME_BLOCK_BEGIN
|
static String |
NAME_BLOCK_END
|
static char |
NAME_DELIMITER
|
static String |
NAME_NEXUS
|
static Pattern |
NAME_SEPARATOR_PATTERN
|
static String |
NAME_TRANSL_TABLE
|
static String |
NAME_TREES
|
static String |
ROOTED_COMMAND
|
static Pattern |
TRANSL_TABLE_PATTERN
|
static Pattern |
TRANSL_TABLE_SEPARATOR_PATTERN
|
static String |
TREE_COMMAND
|
static Pattern |
TREE_COMMAND_PATTERN
|
static char |
TREE_NAME_SEPERATOR
|
static Pattern |
TREES_PATTERN
|
static String |
UNROOTED_COMMAND
|
static Pattern |
WHITESPACE_PATTERN
|
| Constructor Summary | |
|---|---|
NexusParser()
|
|
| Method Summary | |
|---|---|
private static int |
findBlockEnd(NexusCommand[] commands,
int start,
int end)
|
private static int |
findCommand(NexusCommand[] commands,
int start,
int end,
Pattern namePattern,
Pattern tokenPattern)
Searches for the first occurence of the given command. |
static int |
nextPosOutsideComment(String text,
int start,
char character)
Returns the index of the next occurence of character after start
which is not located inside a comment. |
static NexusDocument |
parse(String content)
|
private static String |
parseName(String name)
|
private static void |
readTranslTable(NexusCommand command,
TranslTable translTable)
Reads the content of the passed translation table from the passed command. |
private static boolean |
readTree(String tokens,
NexusDocument document)
Reads a tree from the passed nexus command tokens and adds it to the passed document. |
static String |
removeComments(String content)
Returns the specified string without any comments (seperated by "[" and "]"). |
private static NexusCommand[] |
scan(String content)
Splite the passed text into Nexus commands. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NAME_NEXUS
public static final char COMMENT_START
public static final char COMMENT_END
public static final char NAME_DELIMITER
public static final Pattern NAME_SEPARATOR_PATTERN
public static final Pattern ENCLOSED_NAME_PATTERN
public static final char COMMAND_SEPARATOR
public static final Pattern COMMAND_PATTERN
public static final String ROOTED_COMMAND
public static final String UNROOTED_COMMAND
public static final String NAME_BLOCK_BEGIN
public static final Pattern BLOCK_BEGIN_PATTERN
public static final String NAME_BLOCK_END
public static final Pattern BLOCK_END_PATTERN
public static final String NAME_TREES
public static final Pattern TREES_PATTERN
public static final String NAME_TRANSL_TABLE
public static final Pattern TRANSL_TABLE_PATTERN
public static final Pattern TRANSL_TABLE_SEPARATOR_PATTERN
public static final String TREE_COMMAND
public static final Pattern TREE_COMMAND_PATTERN
public static final Pattern WHITESPACE_PATTERN
public static final Pattern EMPTY_PATTERN
public static final char TREE_NAME_SEPERATOR
| Constructor Detail |
|---|
public NexusParser()
| Method Detail |
|---|
private static NexusCommand[] scan(String content)
content -
public static int nextPosOutsideComment(String text, int start, char character)
character after start
which is not located inside a comment.
text - the text to be searchedstart - the position to start searchingcharacter - the sought-after character
public static String removeComments(String content)
content -
private static int findCommand(NexusCommand[] commands, int start, int end, Pattern namePattern, Pattern tokenPattern)
commands - the list if all commandsstart - the command index to start the searchend - the command index to stop the searchnamePattern - the name of the command (The pattern should describe all
possible names. Patterns are not matched case sensitive)tokenPattern - describes how the token of the command should look like
(Patterns are not matched case sensitive)
private static int findBlockEnd(NexusCommand[] commands, int start, int end)
private static String parseName(String name)
private static void readTranslTable(NexusCommand command, TranslTable translTable)
command - translTable - private static boolean readTree(String tokens, NexusDocument document)
tokens - document - public static NexusDocument parse(String content) throws NexusException
NexusException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||