edu.pdx.cs399J.family
Class TextParser

java.lang.Object
  extended by edu.pdx.cs399J.family.TextParser
All Implemented Interfaces:
Parser

public class TextParser
extends Object
implements Parser

This class parses the text output generated by a TextDumper and creates a family tree.

See Also:
TextDumper

Constructor Summary
TextParser(File file)
          Creates a new text parser that reads its input from the given file.
TextParser(Reader reader)
          Creates a new text parser that reads its input from the given writer.
TextParser(String fileName)
          Creates a new text parser that reads its input from a file of a given name.
 
Method Summary
static void main(String[] args)
          Test program.
 FamilyTree parse()
          Parses the specified input source and from it creates a family tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextParser

public TextParser(String fileName)
           throws FileNotFoundException
Creates a new text parser that reads its input from a file of a given name.

Throws:
FileNotFoundException

TextParser

public TextParser(File file)
           throws FileNotFoundException
Creates a new text parser that reads its input from the given file.

Throws:
FileNotFoundException

TextParser

public TextParser(Reader reader)
Creates a new text parser that reads its input from the given writer. This lets us read from a sources other than files.

Method Detail

parse

public FamilyTree parse()
                 throws FamilyTreeException
Parses the specified input source and from it creates a family tree.

Specified by:
parse in interface Parser
Throws:
FamilyTreeException - The data source is malformatted

main

public static void main(String[] args)
Test program. Parse the file that is given on the command line. Pretty print the resulting family tree.



Copyright © 2000-2009 Portland State University. All Rights Reserved.