Description
You will extend the implementation in Java of the FMap
Collaboration between students is forbidden on this assignment. You are responsible for keeping your code hidden from all other students. Turn in your work on this assignment before 11:59 pm on the due date by following instructions on the course’s main assignments web page, http://www.ccs.neu.edu/course/cs3500sp13/Assignments.html. (The submission command for Assignment 5 will be posted after the late submission deadline for Assignment 4.)
Your file of Java code should begin with a block comment that lists
1. Your name, as you want the instructor to write it.
2. Your email address.
3. Any remarks that you wish to make to the instructor.
Part of your grade will depend on the quality and correctness of your code, part will depend on the readability of your code (comments and indentation), and part will depend on how well you follow the procedure above for submitting your work. Assignments submitted between 12:00 am and 11:59 pm the day after the due date will receive a 20 percentage point penalty on the assignment.
—————————————————————————————————————————
Your assignment is to write the code for a single file, FMap.java, that implements the specification below as well as the specification given in assignment 4. A test program (/course/cs3500sp13/Assignments/A5/TestFMap.java) will be provided.
—————————————————————————————————————————
Specification of the FMap
The FMap
The FMap
The FMap
FMap.empty().containsValue(v) = false
m0.put(k0, v0).containsValue(v)
= m0.containsValue(v) if m0.containsKey(k0)
m0.put(k0, v0).containsValue(v)
= true if ! m0.containsKey(k0)
and v.equals(v0)
m0.put(k0, v0).containsValue(v)
= m0.containsValue(v) if ! m0.containsKey(k0)
and ! v.equals(v0)
In addition, FMap
Signature:
Dynamic methods (whose receiver is an FMap
iterator: -> Iterator
iterator: java.util.Comparator super K> -> Iterator
Specification of the iterator() method:
Returns an Iterator
Specification of the iterator(Comparator super K>) method:
As above, with the additional constraint that the keys are generated in increasing order as determined by the argument passed to the iterator method.
—————————————————————————————————————————
Helpful Resources:
-Liskov – Chapter 6
-Sestoft Section 22.7
-Iterable API: http://docs.oracle.com/javase/6/docs/api/java/lang/Iterable.html
-Iterator API: http://docs.oracle.com/javase/6/docs/api/java/util/Iterator.html
-Collection Interface: http://docs.oracle.com/javase/tutorial/collections/interfaces/collection.html