public class TaggedBinaryHeap<T extends Comparable<T>, E>Since T is a type, T extends Comparable (versus implementing it). This header will ensure that type T has a compareTo method.
class HeapItem<T, E>I get the following warning under <T, E> in the declaration of the HeapItem class:
"The type parameter T is hiding the type T" and "The type parameter E is hiding the type E"But I don't understand what that means nor how to fix it.
Class HeapItem
Object[] heap = new Object[8];You will have to cast the objects in the array to their appropriate type to use them.
Scanner sc = new Scanner(System.in).useDelimiter("\\n");
Change it to:
Scanner sc = new Scanner(System.in);
The only problem that occurs for not setting the delimeter, is that you will not
be able to enter the description of the event to remove an event through the
interactive driver. To make this feature work you'll need to use whatever delimiter
is consistent with your system for the end-of-line character.
public Comparator getTagComparator();
Then in goldman.collection.tagged.TaggedCollectionWrapper.java add the method
public Comparator getTagComparator() {return pairs.getComparator();}
Then for any tagged collection, you can call getTagComparator() to get the comparator
that is used to compare the tags.
TaggedCollection<T,Collection<E>>
by
TaggedCollection<T, ? extends Collection<E>>
So the headers for the two constructors would be as shown below.
public TaggedBucketCollectionWrapper(
TaggedCollection<T, ? extends Collection<E>> tc, BucketFactory<E> factory)
and
public TaggedBucketCollectionWrapper(
TaggedCollection<T, ? extends Collection<E>> tc, final Class bucketType)
The updated version of the TaggedBucketCollectionWrapper
includes this change.
I think the intention of the problem was clear, but technically one of those two changes is needed.
Return to the CSE 241 Home Page