У кого-нибудь есть идеи, как это сделать? Я новичок и должен знать, как выполнить это задание. Очень нужен совет по началу работы с этим проектом, спасибо.
Вот код:
package code;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
/**
*
* This assignment involves character by character
* processing, but this time the characters are not coming from a String, they
* are coming from a file.
*
* Because Java's file input classes throw various exceptions, which we do not
* yet know how to handle, I am providing you with a class which deals with
* those exceptions: UBFileReader. This is an iterator for a file.
* You will be able to use this class during your write-up, but its source will
* be hidden from you.
*
*
*
*
* Overall, the project is a review viewer for various products. The information
* about the reviews and products will be stored in a text file in the following format:
* Products start with <p> and end with </p>
* Reviews start with <c> and end with </c>
* So given the input: <p>Mkay</p><c>Brown and hairy.</c>
* The product would be: "Mkay"
* The review would be: "Brown and hairy."
*
* The products and reviews should be stored in a HashMap<String, LinkedList<String>>
* where the key is the product and the value is a linked list containing all of the
* reviews for the product.
*
* The products and reviews and then displayed in a beautiful (light grey and yellow)
* graphical user interface. The user can use this to browse the available products
* and read their reviews. The user interface will be supplied for you, so all you
* need to take care of is putting the appropriate information in the HashMap.
*
*/
public class TagFileParser {
/**
* Reads a file (identified by inputFilePath), one character at a time.
* Products start with <p> and end with </p> as explained above.
* Reviews start with <c> and end with </c> as explained above.
* Any text not inside of one of these tags should be ignored.
*
* You may use only CharacterFromFileReader to read characters from the
* input file.
*
* In order to simplify the code writing experience, it is recommended
* that you use a switch statement where the case would be the state.
* This way, you only need to worry about what happens when you are at
* that state. You should, however, fully understand the state diagram
* as a whole and in parts, as you will be required to complete this
* assignment next week at the beginning of lab.
*
* @param String
* inputPath the path on the local filesystem to the input file
* @returns a HashMap containing the product->linked list of reviews mappings.
*/
public HashMap<String, List<String>> fillHashMap(String inputPath) {
return null;
}
}