https://github.com/cs1302uga/cs1302-phased-list2This is the website for the assignment details. Please read the weboage as what is allowed and what is not is detailed in there. There is a UML diagram...

1 answer below »
https://github.com/cs1302uga/cs1302-phased-list2This is the website for the assignment details. Please read the weboage as what is allowed and what is not is detailed in there. There is a UML diagram which involves all the necessary methods that need to be implemented. This program builds upon a project done by you guys earlier that I requested. Its is a continuation of the program. To see the code you will need to get access to the anyConnect VPN, the username will be mvp05058 and the first pass will be Uga9253912 and the second pass will be phone. THis will call my phone which I will have to give authorization to let you guys have access. I will authorize it immediately upon having the call. In the two classes listed in the .zip file below I encountered a problem from the previous project. In Array and Linked string list it makes an infinite loop. In a java compiler, in the included test file make a loop and see the result for yourself. The loop that I made was an infinite loop so I would like that fixed as well. To view the .tar file you will need to use the VPN. I can't really access the actual codes in the tar file only see the names of the directories.
Answered 6 days AfterMar 23, 2021

Answer To: https://github.com/cs1302uga/cs1302-phased-list2This is the website for the assignment details....

Sonu answered on Mar 28 2021
153 Votes
cs1302/.classpath

    
    
    
cs1302/.project

     cs1302
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
cs1302/ArrayStringList.class
public synchronized class ArrayStringList extends BaseStringList {
private String[] items;
private int storage;
public void ArrayStringList();
public void ArrayStringList(FancyStringList);
public void clear();
public String get(int);
public String remove(int);
public StringList slice(int, int);
public boolean add(int, String);
private void increseStorage();
private void upd
ateFromBase();
public FancyStringList slice(int, int, int);
public FancyStringList reverse();
}
cs1302/ArrayStringList.java
cs1302/ArrayStringList.java
//package src;
//import cs1302.adt.StringList;
public class ArrayStringList extends BaseStringList{
    private String[] items;
    private int storage;

    // default constructor
    public ArrayStringList(){
        super();
        items = new String[5];
        storage = 5;
    }

    // deep copy constructor
    public ArrayStringList(FancyStringList list){
        clear();
        items = new String[list.size()];
        storage = list.size();
        for(int i = 0;i            append(list.get(i));
        }
    }

    @Override
    public void clear() {
        baseitems = "";
        size = 0;
        items = new String[0];
    }
    @Override
    public String get(int index) {
        updateFromBase();
        if(index < 0 && index >= size) {
            throw new IndexOutOfBoundsException();
        }
        return items[index];
    }
    @Override
    public String remove(int index) {
        updateFromBase();
        if(index < 0 && index >= size) {
            throw new IndexOutOfBoundsException();
        }

        String res = items[index];
        for(int i = index;i            items[i] = items[i+1];
        }
        int c = 0;
        String a = "";
        String b = "";
        for(int i = 0;i            if(baseitems.charAt(i) == ',') {
                c++;
            }
            if(c < index) a += baseitems.charAt(i);
            if(c > index) b += baseitems.charAt(i);
        }
        baseitems = a+b;
        size--;

        return res;
    }
    @Override
    public StringList slice(int start, int stop) {
        updateFromBase();
        if((start < 0  || start >= size) || (stop < 0 ||  stop >= size) || start > stop) {
            throw new IndexOutOfBoundsException();
        }
        StringList res = new ArrayStringList();
        for(int i = start;i            res.add(i-start,items[i]);
        }
        return res;
    }
    @Override
    public boolean add(int index, String item) {
        if(index < 0 && index > size()) {
            throw new IndexOutOfBoundsException();
        }
        if(item == null) {
            throw new NullPointerException();
        }
        if(item == "") {
            throw new IllegalArgumentException();
        }
        if(size() == storage) increseStorage();
        String t = item;
        String prev = item;
        for(int i = index;i            t = items[index];
            items[index] = prev;
            prev = t;
        }
        items[size] = prev;

        int c = 0;
        String a = "";
        String b = "";
        for(int i = 0;i            if(baseitems.charAt(i) == ',') {
                c++;
            }
            if(c < index) a += baseitems.charAt(i);
            if(c >= index) b += baseitems.charAt(i);
        }
        if(a.length() > 0 && b.length() > 0)
            baseitems = a +','+ item + b;
        else
            baseitems = item + ','  + b;

        //System.out.println(baseitems);
        size++;
        return true;
    }

    // function to increase the size of array
    private void increseStorage() {
        String[] temp = items;
        storage = storage + storage/4;
        items = new String[storage];
        for(int i = 0;i            items[i] = temp[i];
        }
    }

    //The string from basestringlist is being converted in array of strings
    private void updateFromBase() {
        String prev = "";
        int k = 0;
        if(size() >= storage)
            increseStorage();
        for(int i = 0;i            if(baseitems.charAt(i) == ','){
                if(prev.length() > 0) items[k++] = prev;
                prev = "";
            }
            else 
                prev += baseitems.charAt(i) ;
        }
    }

    @Override
    public FancyStringList slice(int start, int stop, int step) {
        if(start < 0 || stop > size() || step < 1) {
            throw new IndexOutOfBoundsException();
        }
        FancyStringList fsl = new ArrayStringList();
        for(int i = 0;i            fsl.append(get(i));
        }
        return fsl;
    }

    @Override
    public FancyStringList reverse() {
        int i = 0;
        FancyStringList fsl = new ArrayStringList();
        while(i < size()) {
            fsl.prepend(get(i));
            i++;
        }
        return fsl;
    }


}
cs1302/BaseStringList.class
public abstract synchronized class BaseStringList implements FancyStringList {
protected int size;
protected String baseitems;
public void BaseStringList();
public boolean append(String);
public boolean append(StringList);
public boolean contains(int, String);
public boolean prepend(StringList);
public int indexOf(int, String);
public boolean add(int, StringList);
public boolean isEmpty();
public String makeString(String, String, String);
public boolean prepend(String);
public int size();
public String toString();
public abstract void clear();
public abstract String get(int);
public abstract String remove(int);
public abstract StringList slice(int, int);
public abstract boolean add(int, String);
public abstract FancyStringList reverse();
public abstract FancyStringList slice(int, int,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here