jonvolfson / cs4500-api

0 stars 1 forks source link

Include spec classes for all Array types #11

Closed barrylyung closed 4 years ago

barrylyung commented 4 years ago

In main.cpp, you reference to StringArray, IntArray, BoolArray, FloatArray. However, in your spec, you do not include any class or method stubs to these classes. Please update so we can continue.

Profs have confirmed that these must be provided within the spec if they are included within the tests.

jonvolfson commented 4 years ago

Currently in class without access to my laptop so I’m unable to push until 3:30ish. We have classes for primitive types and strings. Assume that each subclass inherits the same methods as our array class with the return type for methods like get changing accordingly

jonvolfson commented 4 years ago

Can you point to where the professors confirmed this? Is there a piazza post?

NickSimmons97 commented 4 years ago

Jan Vitek told us in person. We are only allowed to implement things that are specified in the spec

jonvolfson commented 4 years ago

Pushed the new classes. Let me know if something seems off. We've decided on our insert/add functionality. The user is only allowed to use insert between indices 0 and length-1. In order to expand the array, the user must use append when there is an item occupying the last item in the array. Append works by keeping track of the biggest index that currently exists and inserting directly after. In a situation where theres an empty index of size 10 and we insert an item at index 9, calling append() would expand the array to size 20 and insert the new item at index 11. We feel like this is the simplest implementation that doesn't involve shifting indices and we are not allowing arrays to shrink.

jonvolfson commented 4 years ago

We will update the tests accordingly now

NickSimmons97 commented 4 years ago

Hey, thank you for adding the array subclasses. Unfortunately, the method stub- virtual void get(size_t index), in parent Array class, will not be able to be overridden by the child methods- int get(size_t index), bool get(size_t index), etc... that you have given us. We talked to Jan earlier today about this overriding issue and he suggested that you remove the virtual void get(size_t index) from the parent class (Array) entirely and only keep the child class methods.

jonvolfson commented 4 years ago

resolved