hw5
Class MarvelParser
java.lang.Object
hw5.MarvelParser
public class MarvelParser
- extends Object
Parser utility to load the Marvel Comics dataset.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MarvelParser
public MarvelParser()
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 readcharacters
- list in which all character names will be stored;
typically empty when the routine is calledbooks
- 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