https://github.com/jjfiv/csc212arraylists
CSC212 Array-Based List Implementations
https://github.com/jjfiv/csc212arraylists
array-list data-structures dynamic-array smith-csc212
Last synced: about 1 month ago
JSON representation
CSC212 Array-Based List Implementations
- Host: GitHub
- URL: https://github.com/jjfiv/csc212arraylists
- Owner: jjfiv
- Created: 2019-10-07T14:10:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-10T14:39:58.000Z (over 5 years ago)
- Last Synced: 2025-05-15T02:36:47.378Z (5 months ago)
- Topics: array-list, data-structures, dynamic-array, smith-csc212
- Language: Java
- Homepage: https://jjfoley.me/csc212/
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 38
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CSC212ArrayLists
Array-based List Data Structures via Testing### ListADT Methods to implement
Note: ``ListADT`` and friends are not actually in this repository.
- You can browse the [online Javadoc](https://javadoc.jitpack.io/com/github/jjfiv/CSC212ADT/1.3/javadoc/index.html).
- You can directly [import the code](https://github.com/jjfiv/CSC212ADT) if you want.The most important portions of the interface are:
```java
public abstract class ListADT ... {
...
public T removeFront();
public T removeBack();
public T removeIndex(int index);
public void addFront(T item);
public void addBack(T item);
public void addIndex(int index, T item);public T getFront();
public T getBack();
public T getIndex(int index);
public void setIndex(int index, T value);public int size();
public boolean isEmpty();
}
```### Errors:
Where appropriate, you should throw my error classes instead of ``NullPointerException``s or ``ArrayIndexOutOfBoundsException``s. It is good programming practice to not expose those to your users, and it also demonstrates that you're reasoning about your code and its failure cases.
I provide errors for:
- ``TODOErr``, so I can quickly tell if you have not changed the starter code in a particular case. You will be deleting these errors, not adding them.
- ``EmptyListError``, when a remove or get operation is called on an empty list. See ``checkNotEmpty()``
- ``BadIndexError``, when a getIndex, addIndex or removeIndex operation is called with an index that does not exist. See ``checkExclusiveIndex`` and ``checkInclusiveIndex``.
- ``RanOutOfSpaceError``, when an add method fails on a ``FixedSizeList`` because it has run out of space.Prefer the most precise error: ``EmptyListError`` rather than a ``BadIndexError`` when looking for the 5th thing in an empty list.
## No reflection or form this week.
This assignment is purely graded on test accuracy.
## Rubric (100)
Right now, when I run all the tests in this project, I get the following output:
```
Tests run: 82, Failures: 0, Errors: 57, Skipped: 0
```So there are 25 passing tests, and 57 failing tests.
Your score on this assignment will range up to 100% -- the fraction of the tests that pass on your code (minus the tests that already pass), provided:
1. there are no code compilation problems with your code (red lines or Problems in Eclipse).
2. you do not rename any methods or modify the tests in any way, and
3. you resolve any infinite loops in your code (better to comment out that method and have it crash than run forever -- it prevents other tests from running.Every test is a little less than 2 points of your grade.
## What should I do first?
There are TODOErr methods in:
Start with ``FixedSizeList``.
- ``src/main/java/edu/smith/cs/csc212/adtr/real/FixedSizeList.java``
- The challenges here are removeIndex (need to slide elements to the left) and addIndex (need to slide elements to the right).
- The one we discussed in class is easier, start there.Then, work to complete ``GrowableList`` which is an ArrayList implementation based on ``FixedSizeList`` (literally most of the methods are exactly the same) but it needs a resizeArray method to be completed.
- ``src/main/java/edu/smith/cs/csc212/adtr/real/GrowableList.java``
- Start with copying over methods from ``FixedSizeList`` which are exactly the same...Then, work on ``ChunkyArrayList``: This data structure is very different from the others, because it uses GrowableList and FixedSizeList to make another.
- ``src/main/java/edu/smith/cs/csc212/adtr/real/ChunkyArrayList.java``
- This is a totally different, challenge data structure.
- It doesn't use ``ArrayWrapper`` directly. It uses ``GrowableList`` and ``FixedSizeList``.
- Don't let it have any empty "chunks" in the middle.
- When you delete the last item from a chunk, delete the rest of the chunk.