In this assignment you will work on a toy JSON parser. JSON is a popular text format used for serialization of primitive data types, arrays and objects (represented by key-value pairs). You can read more about JSON on Wikipedia ( http://en.wikipedia.org/wiki/JSON ) and its official website ( http://json.org/ ).
Your task is to implement a parser for JSON stored in text files with specific formatting (to avoid the need for complex parsing techniques) where every value or control character is stored on a separate line:
{
"example"
:
[
"string 1"
,
"string 2"
]}
For simplicity's sake, only strings will be used as values in JSON files used for this assignment.
Implement a Queue ADT for generic element types that supports the following operations:
Your class must implement the interface provided in file "A1Queue.java".
A reminder: you may implement your ADTs from scratch or use existing classes from Java standard library in some way.
Implement a Stack ADT for generic element types that supports the following operations:
Your class must implement the interface provided in file "A1Stack.java".
Implement a TreeNode ADT for generic element types that supports the following operations:
Your class must implement the interface provided in file "A1TreeNode.java".
Implement a Tree ADT for generic element types that supports the following operations:
Your class must implement the interface provided in file "A1Tree.java".
Hint: it is assumed that "null" will be specified as the parent node when inserting the first (root) node into the tree.
Using the data types implemented in previous exercises, implement a class that would:
Your class must implement the interface provided in file "A1Main.java".
Hint: to process nested data structures in JSON document, you should maintain a A1Stack of nodes that are parents to each other and pop elements from the stack when encountering a control character like "]" or "}".
While printing the tree, correct indentation must be preserved (you can choose the policy for printing control characters for yourself).