2,621 bytes added
, 17:38, 16 March 2007
* Due Date: Friday, March 30 (+ epsilon)
* The official spec is [http://www.cs.umd.edu/~meesh/cmsc420/spr07/part1/p11/ here]. Current version: Draft 1.1
* As always, the spec will freeze 1 week prior to the due date.
== Overview ==
From the spec:
<blockquote>
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.
</blockquote>
== Data structures ==
# Data Dictionary ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/TreeMap.html TreeMaps] and [http://java.sun.com/j2se/1.5.0/docs/api/java/util/TreeSet.html TreeSets] for part 1)
#* Related commands:
#** [[createCity]]
#** [[deleteCity]]
#** [[listCities]]
#** [[clearAll]]
# Spatial Map (PR Quadtree for part 1)
#* Related commands:
#** [[deleteCity]] (if the city is mapped)
#** [[mapCity]]
#** [[unmapCity]]
#** [[rangeCities
#** [[nearestCity]]
#** [[saveMap]]
#** [[clearAll]]
== Commands ==
The operations you will need to support can be gleaned from the [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node26.html input specification]:
* [[createCity]] and [[deleteCity]]: You will need to be able to register cities with and remove them from the data dictionary. No two cities can have the same coordinates or name.
* [[mapCity]] and [[unmapCity]]: These take a city that's already registered in the data dictionary and add it to or remove it from the spatial data structure.
* [[listCities]]: Output a sorted (XML) list of cities in the data dictionary.
* [[rangeCities]]: This searches the spatial data structure for all cities within a given radius of a given point.
* [[nearestCity]]: This finds the nearest city to a given point in the spatial map.
* [[printPRQuadtree]]: This outputs an XML (textual) representation of the spatial map.
* [[saveMap]]: This outputs a visual representation (an image) of the spatial data structure. See [[CanvasPlus]].
* [[clearAll]]: Clears all of the data structures, removing all elements.