Difference between revisions of "Part 1"

From CMSC 420
 
(2 intermediate revisions by the same user not shown)
Line 14: Line 14:
  
 
== Data structures ==
 
== Data structures ==
# Data Dictionary ([http://java.sun.com/j2se/1.6.0/docs/api/java/util/TreeMap.html TreeMap] and [http://java.sun.com/j2se/1.6.0/docs/api/java/util/TreeSet.html TreeSet] for part 1)
+
#Data Dictionary ([http://java.sun.com/j2se/1.6.0/docs/api/java/util/TreeMap.html TreeMap] and [http://java.sun.com/j2se/1.6.0/docs/api/java/util/TreeSet.html TreeSet] for part 1)
#* Related commands:
+
#*Related commands:
 
#** [[createCity]]
 
#** [[createCity]]
 
#** [[listCities]]
 
#** [[listCities]]
Line 30: Line 30:
  
 
The general conventions in the spec can be found [https://www.cs.umd.edu/users/meesh/420/ProjectBook/part1/p11/node20.html here] and the more specific directions for each commands can be found [https://www.cs.umd.edu/users/meesh/420/ProjectBook/part1/p11/node22.html here]
 
The general conventions in the spec can be found [https://www.cs.umd.edu/users/meesh/420/ProjectBook/part1/p11/node20.html here] and the more specific directions for each commands can be found [https://www.cs.umd.edu/users/meesh/420/ProjectBook/part1/p11/node22.html here]
* <[[success]]>: This is when your parser has successfully parsed and finished a command.
+
* '''<success>''': This is when your parser has successfully parsed and finished a command.
* <[[error]]>: When an error occurs after attempting to run a command
+
* '''<error>''': When an error occurs after attempting to run a command
* <[[fatalError]]>: There is a problem with the entire document
+
* '''<fatalError>''': There is a problem with the entire document
* <[[undefinedError]]>: Default error, when we aren't sure exactly what happened
+
* '''<undefinedError>''': Default error, when we aren't sure exactly what happened
  
 
By the end, your output will be XML that minimally looks like this:
 
By the end, your output will be XML that minimally looks like this:

Latest revision as of 01:26, 6 February 2017

Part 1 of the MeeshQuest project:

  • Due Date: Either the date on the submit server or the date on the project spec, whichever is later
  • All part 1 files can be found here
  • The official spec is here with name p1x, for the largest value of x in that directory.
  • As always, the spec will freeze 1 week (5 days summer) prior to the due date.
  • Test Files

Overview[edit]

From the spec:

For the first part of your project, you will implement a data dictionary that supports both city names and city coordinates as keys. You will also need to write an interpreter that will be able to handle basic XML commands. Your data dictionary can be written by merely playing games with comparators, thereby convincing a good old TreeMap or TreeSet to act like it's something else altogether. Commands will require you to insert verified cities into the spatial map, and to delete them from the spatial map. The role of the spatial map is to support range searches where, given a location in 2-d space and a radius, you will find all the cities within that circle, including on the border. These types of operations are not efficient using the TreeMap of coordinates.

Data structures[edit]

  1. Data Dictionary (TreeMap and TreeSet for part 1)

Commands[edit]

The operations you will need to support can be gleaned from the spec:

  • createCity: You will need to be able to register cities with the data dictionary. No two cities can have the same coordinates or name.
  • clearAll: Clears all of the data structures, removing all elements.
  • listCities: Output a sorted (XML) list of cities in the data dictionary.

Output[edit]

The general conventions in the spec can be found here and the more specific directions for each commands can be found here

  • <success>: This is when your parser has successfully parsed and finished a command.
  • <error>: When an error occurs after attempting to run a command
  • <fatalError>: There is a problem with the entire document
  • <undefinedError>: Default error, when we aren't sure exactly what happened

By the end, your output will be XML that minimally looks like this:

<results>
   <success ... />
   <success ... />
   <success ... />
   <error ... />
   <success ... />
   ...
   <success ... />
</results>

Testing[edit]

Your code will be run from the public static void main(String[]) method of the Meeshquest class in a package named "cmsc420.meeshquest.part1". It will read in its input from stdin and write its output to stdout.

You can see exactly how your code will be tested by examining the public tests. For some example student-generated tests, see Test Files.