Class PrettyPrinter

java.lang.Object
edu.pdx.cs410J.family.PrettyPrinter
All Implemented Interfaces:
Dumper

public class PrettyPrinter extends Object implements Dumper
This class dumps a family tree to a text file in a format that can be read by a person.
Author:
David Whitlock
  • Constructor Details

    • PrettyPrinter

      public PrettyPrinter(String fileName) throws IOException
      Creates a new pretty printer that prints to a file of a given name. If the file does not exist, it is created.
      Throws:
      IOException
    • PrettyPrinter

      public PrettyPrinter(File file) throws IOException
      Creates a new pretty printer that prints to a given file.
      Throws:
      IOException
    • PrettyPrinter

      Creates a new pretty printer that prints to a PrintWriter. This way, we can print to destinations other than files (such as the console).
  • Method Details

    • dump

      public void dump(FamilyTree tree)
      Prints the contents of the given family tree in a human-readable format.
      Specified by:
      dump in interface Dumper
    • main

      public static void main(String[] args)
      Test program. Create a simple family tree and print it to the console.