Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document.io.nexus
Class NexusParser

    java.lang.Object
      info.bioinfweb.treegraph.document.io.nexus.NexusParser

    public class NexusParser

extends java.lang.Object

Field Summary
`static java.util.regex.Pattern` | `BLOCK_BEGIN_PATTERN`
`static java.util.regex.Pattern` | `BLOCK_END_PATTERN`
`static java.util.regex.Pattern` | `COMMAND_PATTERN`
`static char` | `COMMAND_SEPARATOR`
`static char` | `COMMENT_END`
`static char` | `COMMENT_START`
`static java.util.regex.Pattern` | `EMPTY_PATTERN`
`static java.util.regex.Pattern` | `ENCLOSED_NAME_PATTERN`
`static java.lang.String` | `NAME_BLOCK_BEGIN`
`static java.lang.String` | `NAME_BLOCK_END`
`static char` | `NAME_DELIMITER`
`static java.lang.String` | `NAME_NEXUS`
`static java.util.regex.Pattern` | `NAME_SEPARATOR_PATTERN`
`static java.lang.String` | `NAME_TRANSL_TABLE`
`static java.lang.String` | `NAME_TREES`
`static java.lang.String` | `ROOTED_COMMAND`
`static java.util.regex.Pattern` | `TRANSL_TABLE_PATTERN`
`static java.util.regex.Pattern` | `TRANSL_TABLE_SEPARATOR_PATTERN`
`static java.lang.String` | `TREE_COMMAND`
`static java.util.regex.Pattern` | `TREE_COMMAND_PATTERN`
`static char` | `TREE_NAME_SEPERATOR`
`static java.util.regex.Pattern` | `TREES_PATTERN`
`static java.lang.String` | `UNROOTED_COMMAND`
`static java.util.regex.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, java.util.regex.Pattern namePattern, java.util.regex.Pattern tokenPattern)` Searches for the first occurence of the given command.
`static int` | `nextPosOutsideComment(java.lang.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(java.lang.String content)`
`private static java.lang.String` | `parseName(java.lang.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(java.lang.String tokens, NexusDocument document)` Reads a tree from the passed nexus command tokens and adds it to the passed document.
`static java.lang.String` | `removeComments(java.lang.String content)` Returns the specified string without any comments (seperated by "[" and "]").
`private static NexusCommand[]` | `scan(java.lang.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

### NAME_NEXUS

    public static final java.lang.String NAME_NEXUS

See Also:
  Constant Field Values

### COMMENT_START

    public static final char COMMENT_START

See Also:
  Constant Field Values

### COMMENT_END

    public static final char COMMENT_END

See Also:
  Constant Field Values

### NAME_DELIMITER

    public static final char NAME_DELIMITER

See Also:
  Constant Field Values

### NAME_SEPARATOR_PATTERN

    public static final java.util.regex.Pattern NAME_SEPARATOR_PATTERN

### ENCLOSED_NAME_PATTERN

    public static final java.util.regex.Pattern ENCLOSED_NAME_PATTERN

### COMMAND_SEPARATOR

    public static final char COMMAND_SEPARATOR

See Also:
  Constant Field Values

### COMMAND_PATTERN

    public static final java.util.regex.Pattern COMMAND_PATTERN

### ROOTED_COMMAND

    public static final java.lang.String ROOTED_COMMAND

See Also:
  Constant Field Values

### UNROOTED_COMMAND

    public static final java.lang.String UNROOTED_COMMAND

See Also:
  Constant Field Values

### NAME_BLOCK_BEGIN

    public static final java.lang.String NAME_BLOCK_BEGIN

See Also:
  Constant Field Values

### BLOCK_BEGIN_PATTERN

    public static final java.util.regex.Pattern BLOCK_BEGIN_PATTERN

### NAME_BLOCK_END

    public static final java.lang.String NAME_BLOCK_END

See Also:
  Constant Field Values

### BLOCK_END_PATTERN

    public static final java.util.regex.Pattern BLOCK_END_PATTERN

### NAME_TREES

    public static final java.lang.String NAME_TREES

See Also:
  Constant Field Values

### TREES_PATTERN

    public static final java.util.regex.Pattern TREES_PATTERN

### NAME_TRANSL_TABLE

    public static final java.lang.String NAME_TRANSL_TABLE

See Also:
  Constant Field Values

### TRANSL_TABLE_PATTERN

    public static final java.util.regex.Pattern TRANSL_TABLE_PATTERN

### TRANSL_TABLE_SEPARATOR_PATTERN

    public static final java.util.regex.Pattern TRANSL_TABLE_SEPARATOR_PATTERN

### TREE_COMMAND

    public static final java.lang.String TREE_COMMAND

See Also:
  Constant Field Values

### TREE_COMMAND_PATTERN

    public static final java.util.regex.Pattern TREE_COMMAND_PATTERN

### WHITESPACE_PATTERN

    public static final java.util.regex.Pattern WHITESPACE_PATTERN

### EMPTY_PATTERN

    public static final java.util.regex.Pattern EMPTY_PATTERN

### TREE_NAME_SEPERATOR

    public static final char TREE_NAME_SEPERATOR

See Also:
  Constant Field Values

Constructor Detail

### NexusParser

    public NexusParser()

Method Detail

### scan

    private static NexusCommand[] scan(java.lang.String content)

  Splite the passed text into Nexus commands. Comments are not removed.

  Parameters:
    `content` -
  Returns:

### nextPosOutsideComment

    public static int nextPosOutsideComment(java.lang.String text,
                                            int start,
                                            char character)

  Returns the index of the next occurence of `character` after `start` which is not located inside a comment.

  Parameters:
    `text` - - the text to be searched
    `start` - - the position to start searching
    `character` - - the sought-after character
  Returns:
    the position or -1 if the character was not found

### removeComments

    public static java.lang.String removeComments(java.lang.String content)

  Returns the specified string without any comments (seperated by "[" and "]").

  Parameters:
    `content` -
  Returns:

### findCommand

    private static int findCommand(NexusCommand[] commands,
                                   int start,
                                   int end,
                                   java.util.regex.Pattern namePattern,
                                   java.util.regex.Pattern tokenPattern)

  Searches for the first occurence of the given command.

  Parameters:
    `commands` - - the list if all commands
    `start` - - the command index to start the search
    `end` - - the command index to stop the search
    `namePattern` - - 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)
  Returns:
    the index of the first match in the given array of command or -1 if none was found

### findBlockEnd

    private static int findBlockEnd(NexusCommand[] commands,
                                    int start,
                                    int end)

### parseName

    private static java.lang.String parseName(java.lang.String name)

### readTranslTable

    private static void readTranslTable(NexusCommand command,
                                        TranslTable translTable)

  Reads the content of the passed translation table from the passed command. The command tokens-string may contain comments.

  Parameters:
    `command` -
    `translTable` -

### readTree

    private static boolean readTree(java.lang.String tokens,
                                    NexusDocument document)

  Reads a tree from the passed nexus command tokens and adds it to the passed document. Comments are left inside both the name and the tree string.

  Parameters:
    `tokens` -
    `document` -

### parse

    public static NexusDocument parse(java.lang.String content)
                               throws NexusException

  Throws:
    `NexusException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD