next up previous
Next: Part 2: Robust Site Up: Part 1: TreeMaps, Fibonacci Previous: BNF

Commands

EXIT()
This is the simplest command. It should end the program. Your program should also naturally terminate (with no exit message) when the end-of-file is reached. Print a goodbye message and exit the program.

Output summary:
<output>:=mission complete.<nl>

CLEAR_ALL()
This command takes no parameters. This command should delete all entries from the dictionary, spatial data structure, and inventory heap. (Hint: You don't actually have to perform any delete operations on any of these objects.) A confirmation message should be printed.

Output summary:
<output>:=sites cleared.<nl>

CREATE_BASE(name, latitude, longitude)
This command takes three parameters: the name of the Base as a case insensitive string, the latitude as an integer, and the longitude as an integer. Both latitude and longitude will be integers in the range [0, 1024). Your Mediator should parse this information and store it in a base object. If the dictionary does not already contain a base/target (site) by the same name, you should add the base to the dictionary and print the <success> message. If there is a site in the dictionary with the same name, you should print the <SiteAlreadyExists> error message. Note that the sites should be sorted asciibetically by their case insensitive name. This should be an O(log n) operation.

Output summary:
<output>:= <success>|<error>
<success>:=created base <Site>.<nl>
<error>:=<SiteAlreadyExists>

CREATE_TARGET(name, latitude, longitude)
This command takes three parameters: the name of the Target as a case insensitive string, the latitude as an integer, and the longitude as an integer. Both latitude and longitude should be integers in the range [0, 1024). Your Mediator should parse this information and store it in a Target object. If the dictionary does not already contain a base/target (site) by the same name, you should add the Target to the dictionary and print the <success> message. If there is a site in the dictionary with the same name, you should print the <SiteAlreadyExists> error message. Note that the sites should be sorted asciibetically by their case insensitive name. This should be an O(log n) operation.

Output summary:
<output>:= <success>|<error>
<success>:=created base <Site>.<nl>
<error>:=<SiteAlreadyExists>

DELETE_DATA(name)
This command takes in one parameter: the name of the Site as a case insensitive string. Your Mediator should search the dictionary for a Site with the specified name. If you find a Site with that case insensitive name and the Site has not been added to the spatial data structure, remove it from the dictionary and print the <success> message. If the Site is in the dictionary but has already been added to the spatial data structure, then print the <UnableToDeleteSite> error message. If the Site cannot be found in the dictionary, print the <SiteDoesNotExist> error. This should be an O(log n) operation.

Output summary:
<output>:=<success>|<error>
<success>:=deleted site <Site>.<nl>
<error>:=<SiteDoesNotExist>|<UnableToDeleteSite>

LIST_SITES()
This command takes no parameters. This command should print out a list of all of the Site in the dictionary in asciibetically sorted order. If the dictionary is empty, print the
<NoSitesEntered> message. If there are Sites in the dictionary, print them as described below. Note that Site names are case insensitive so if the name of one Site was "baltimore" and another Site was named "Reno" then "Reno" would be printed before "baltimore" (since "R" comes before "b" in the ASCII character set).

Note: This Command takes the place of PRINT_DICTIONARY().

Output summary:
<output>:=<SiteList>|<NoSitesEntered>
<SiteList>:=<Site><nl><SiteList>|<Site><nl>
<NoSitesEntered>:=No Sites have been entered into the dictionary.<nl>

MAP_SITE(name)
This command takes one parameter: the name of the Site to map as a case sensitive string. You should search the dictionary for the Site. If you find the Site in the dictionary and it has not already been mapped, map it by adding it to the spatial data structure and print the <success> message. If the Site was found but was already mapped, print the <SiteAlreadyMapped> error message. If the Site could not be found, print the <SiteDoesNotExist> error message. Recall that both latitude and longitude are integers in the range [0, 1024).

Note: Takes the place of MAP_DATA().

Output summary:
<output>:=<success>|<error>
<success>:=Mapped site <Site>.<nl>
<error>:=<SiteDoesNotExist>|<SiteAlreadyMapped>

PRINT_MAP()
This command takes no parameters. This command prints the spatial data structure.

Output summary:
<output>:=<SiteList>|<NoSitesEntered>
<SiteList>:=<Site><nl><SiteList>|<Site><nl>
<NoSitesEntered>:=no spatial data.<nl>


next up previous
Next: Part 2: Robust Site Up: Part 1: TreeMaps, Fibonacci Previous: BNF
MM Hugue 2004-02-28

Web Accessibility