Anonymous

Changes

From CMSC 420
1,492 bytes added ,  23:44, 10 September 2013
Created page with "Prints all cities currently present in the dictionary. The order in which the attributes for the <city> tags are listed is unimportant. However, the city tags themselves must ..."
Prints all cities currently present in the dictionary. The order in which the attributes for the <city> tags are listed is unimportant. However, the city tags themselves must be listed in ascending order either by name or by coordinate, as per the sortBy attribute in the listCities command, whose two legal values are name and coordinate. The ordering by name is asciibetical according to the java.lang.String.compareTo() method, and the ordering by coordinate is discussed in the spec. To reiterate, coordinate ordering is done by comparing '''x''' values first; for cities with the same '''x''' value, one city is less than another city if its '''y''' value is less than the other. This command is only successful if there is at least 1 (1 or more) cities in the dictionary.

== Parameters ==
*sortBy

== Possible <output> ==
A <cityList> tag will be contained in output and will contain 1 or more city tags of the form:
<br>
<code>
<city name="city1" x="coordx" y="coordy" color="color1" radius="radius1"/>
</code>

== Possible <error> types ==
* noCitiesToList

== <success> Example ==
<code>
<success>
<command name="listCities"/>
<parameters>
<sortBy value="name"/>
</parameters>
<output>
<cityList>
<city name="Annapolis" x="19" y="20" color="red" radius="40"/>
<city name="Derwood" x="5" y="5" color="blue" radius="90"/>
</cityList>
</output>
</success>
</code>
editor
68

edits