hw5
Class MarvelParser

java.lang.Object
  extended by hw5.MarvelParser

public class MarvelParser
extends Object

Parser utility to load the Marvel Comics dataset.


Constructor Summary
MarvelParser()
           
 
Method Summary
static void parseData(String filename, Set<String> characters, Map<String,List<String>> books)
          Reads the Marvel Universe dataset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarvelParser

public MarvelParser()
Method Detail

parseData

public static void parseData(String filename,
                             Set<String> characters,
                             Map<String,List<String>> books)
                      throws Exception
Reads the Marvel Universe dataset. Each line of the input file contains a character name and a comic book the character appeared in, separated by a tab character

Parameters:
filename - the file that will be read
characters - list in which all character names will be stored; typically empty when the routine is called
books - map from titles of comic books to characters that appear in them; typically empty when the routine is called
Throws:
Exception
Requires:
file is well-formed, with each line containing exactly two tokens separated by a tab, or else starting with a # symbol to indicate a comment line.
Effects:
  • fills characters with a list of all unique character names
  • fills books with a map from each comic book to all characters appearing in it
Modifies:
characters, books