From f9fe90226f941d00ade3d4278d1bbcdf54f1d993 Mon Sep 17 00:00:00 2001
From: Rong Huang <851113375@qq.com>
Date: Sun, 26 Feb 2017 18:45:56 +0800
Subject: [PATCH] =?UTF-8?q?Revert=20"=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=95=B0?=
 =?UTF-8?q?=E6=8D=AE=E7=BB=93=E6=9E=84=E4=BD=9C=E4=B8=9A"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../coding2017/basic/MyArrayList.java         |  83 ------------
 .../coding2017/basic/MyLinkedList.java        | 119 -----------------
 .../lhpmatlab/coding2017/basic/MyQueue.java   |  29 -----
 .../lhpmatlab/coding2017/basic/MyStack.java   |  30 -----
 .../coding2017/basic/MyArrayListTest.java     | 113 ----------------
 .../coding2017/basic/MyLinkedListTest.java    | 121 ------------------
 .../coding2017/basic/MyQueueTest.java         |  71 ----------
 .../coding2017/basic/MyStackTest.java         | 104 ---------------
 8 files changed, 670 deletions(-)
 delete mode 100644 group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyArrayList.java
 delete mode 100644 group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyLinkedList.java
 delete mode 100644 group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyQueue.java
 delete mode 100644 group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyStack.java
 delete mode 100644 group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyArrayListTest.java
 delete mode 100644 group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyLinkedListTest.java
 delete mode 100644 group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyQueueTest.java
 delete mode 100644 group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyStackTest.java

diff --git a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyArrayList.java b/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyArrayList.java
deleted file mode 100644
index 03f671078..000000000
--- a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyArrayList.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/18.
- */
-public class MyArrayList<T> {
-
-    private Object[] initialArray = {};
-    private Object[] dataArray;
-    private int initSize = 10;
-    private int arraySize;
-    public MyArrayList() {
-        dataArray = initialArray;
-    }
-
-    public MyArrayList(int init) {
-        dataArray = new Object[init];
-    }
-
-    public void ensureCapacity(int newCapacity) {
-        if (newCapacity < arraySize)
-            return;
-
-        Object[] old = dataArray;
-        dataArray = new Object[newCapacity];
-        for (int i = 0; i < size(); i++) {
-            dataArray[i] = old[i];
-        }
-    }
-
-    public void add(T element) {
-        add(size(), element);
-    }
-
-    public void add(int index, T element) {
-        if (size() == dataArray.length) {
-            ensureCapacity(size()*2 + 1);
-        }
-        for(int i=arraySize;i>index;i--) {
-            dataArray[i] = dataArray[i - 1];
-        }
-        dataArray[index] = element;
-        arraySize++;
-    }
-
-    public T delete(int index) {
-        if (index < 0 || index > arraySize) {
-            throw new ArrayIndexOutOfBoundsException();
-        }
-        T removeElement = (T)dataArray[index];
-        for (int i = index; i < size() -1; i++) {
-            dataArray[i] = dataArray[i + 1];
-        }
-        arraySize--;
-        return removeElement;
-    }
-
-    public T get(int index) {
-        if (index < 0 || index > arraySize) {
-            throw new ArrayIndexOutOfBoundsException();
-        }
-        return (T)dataArray[index];
-    }
-
-    public T set(int index, T newElement) {
-        if (index < 0 || index > arraySize) {
-            throw new ArrayIndexOutOfBoundsException();
-        }
-        T oldElement = (T) dataArray[index];
-        dataArray[index] = newElement;
-
-        return oldElement;
-    }
-
-    public int size() {
-        return arraySize;
-    }
-
-    public boolean isEmpty() {
-        return size() == 0;
-    }
-
-}
diff --git a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyLinkedList.java b/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyLinkedList.java
deleted file mode 100644
index 9e7eab340..000000000
--- a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyLinkedList.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/18.
- */
-public class MyLinkedList<T> {
-	 private class Node<T> {
-	        public Node<T> pre;
-	        public Node<T> next;
-	        public T data;
-
-	        public Node(Node<T> pre,Node<T> next,T data) {
-	            this.pre = pre;
-	            this.next = next;
-	            this.data = data;
-	        }
-	    }
-
-	    private int dataSize;
-
-	    private Node head;
-	    private Node tail;
-
-	    public MyLinkedList() {
-	        head = new Node<T>(null,null,null);
-	        tail = new Node(head, null, null);
-	        head.next = tail;
-	        dataSize = 0;
-	    }
-
-	    public void add(T t) {
-//	        add(size(), t);
-	        Node<T> newNode = new Node<>(null, tail, t);
-	        newNode.pre = tail.pre;
-	        tail.pre.next = newNode;
-	        tail.pre = newNode;
-	        dataSize++;
-
-	    }
-
-	    /**
-	     * 根据索引添加没有实现
-	     * @param index
-	     * @param element
-	     */
-	    public void add(int index,T element) {
-	        //TODO 根据索引添加元素
-//	        addBefore(getNode(index,0,size()-1),element);
-//	        if (index == dataSize) {
-//	            add(element);
-//	        } else {
-	//
-//	        }
-	    }
-
-	    public T get(int index) {
-	        return getNode(index).data;
-	    }
-
-	    public T set(int index, T newValue) {
-	        Node<T> node = getNode(index);
-	        T oldData = node.data;
-	        node.data = newValue;
-	        return oldData;
-	    }
-
-	    public T remove(int index) {
-	        Node<T> node = getNode(index);
-	        node.next.pre = node.pre;
-	        node.pre.next = node.next;
-	        dataSize--;
-
-	        return node.data;
-
-	    }
-
-	    private void addBefore(Node<T> node, T element) {
-//	        newNode.pre.next = newNode;
-//	        node.pre = newNode;
-	        Node<T> pre = node.pre;
-	        Node<T> newNode = new Node<>(node.pre, node, element);
-	        node.pre = newNode;
-	        pre.next = newNode;
-
-	        dataSize++;
-	    }
-
-	    private Node<T> getNode(int index) {
-	        return getNode(index, 0, size());
-	    }
-
-	    private Node<T> getNode(int index, int lower, int upper) {
-	        Node<T> p;
-	        if (index < lower || index > upper) {
-	            throw new IndexOutOfBoundsException();
-	        }
-
-	        if (index < size() / 2) {
-	            p = head.next;
-	            for (int i = 0; i < index; i++) {
-	                p = p.next;
-	            }
-	        } else {
-	            p = tail.pre;
-	            for (int i = size()-1; i > index; i--) {
-	                p = p.pre;
-	            }
-	        }
-	        return p;
-	    }
-
-	    public int size() {
-	        return dataSize;
-	    }
-
-	    public boolean isEmpty() {
-	        return size() == 0;
-	    }
-}
diff --git a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyQueue.java b/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyQueue.java
deleted file mode 100644
index 6d0c970b6..000000000
--- a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyQueue.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/22.
- */
-public class MyQueue<T> {
-    private MyLinkedList<T> link = new MyLinkedList<>();
-
-    public void enQueue(T t) {
-        link.add(t);
-    }
-
-    public T deQueue() {
-        if (size() <= 0) {
-            return null;
-        }
-        T t = link.get(0);
-        link.remove(0);
-        return t;
-    }
-
-    public boolean isEmpty() {
-        return size() == 0;
-    }
-
-    public int size() {
-        return link.size();
-    }
-}
diff --git a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyStack.java b/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyStack.java
deleted file mode 100644
index 3fd9d2f5c..000000000
--- a/group02/435994736Learning/src/main/java/com/github/lhpmatlab/coding2017/basic/MyStack.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/22.
- */
-public class MyStack<T> {
-    private MyArrayList<T> list = new MyArrayList<>();
-
-    public void push(T t) {
-        list.add(t);
-    }
-
-    public T pop() {
-        if (size() <= 0) {
-            throw new IndexOutOfBoundsException();
-        }
-        return list.delete(size() - 1);
-    }
-
-    public T peek() {
-        return list.get(size() - 1);
-    }
-
-    public boolean isEmpty() {
-        return list.size() == 0;
-    }
-    public int size() {
-        return list.size();
-    }
-}
diff --git a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyArrayListTest.java b/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyArrayListTest.java
deleted file mode 100644
index e29d41fea..000000000
--- a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyArrayListTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class MyArrayListTest {
-	 private MyArrayList<String> list;
-
-	    @Before
-	    public void init(){
-	        list = new MyArrayList<>();
-	    }
-
-	    @Test
-	    public void testEnsureCapacity() {
-	        assertEquals("init list size is 0  ", list.size(), 0);
-	        list.add("1");
-	        list.ensureCapacity(10);
-	        assertEquals("ensureCapacity size is 10 ", list.size(),1);
-	    }
-
-	    /**
-	     * 在列表的末尾添加元素
-	     */
-	    @Test
-	    public void testAddT() {
-	        assertEquals("init list size is 0  ", list.size(), 0);
-	        list.add("1");
-	        list.add("2");
-	        assertEquals("add list size ", list.size(), 2);
-	        for (int i=0; i<list.size(); i++) {
-	            assertEquals("index of"+i,list.get(i),""+(i+1));
-	        }
-	    }
-
-	    /**
-	     * 测试在list的任意索引处添加元素
-	     */
-	    @Test
-	    public void testAddIntT() {
-	        assertEquals("init list size is 0  ", list.size(), 0);
-	        list.add("1");
-	        list.add("3");
-	        list.add(1,"2");
-	        assertEquals("add list size ", list.size(), 3);
-	        assertEquals("add index 1 element is" ,list.get(1),"2");
-	        for (int i=0; i<list.size(); i++) {
-	            assertEquals("index of"+i,list.get(i),""+(i+1));
-	        }
-	    }
-
-	    @Test
-	    public void testDelete() {
-	        assertEquals("init list size is 0  ", list.size(), 0);
-	        list.add("1");
-	        list.add("3");
-	        list.add(1,"2");
-	        assertEquals("add list size ", list.size(), 3);
-	        list.delete(1);
-	        assertEquals("after delete index 1 ",list.get(1),"3");
-	    }
-
-	    @Test
-	    public void testGet() {
-	        assertEquals("init list size is 0  ", list.size(), 0);
-	        list.add("1");
-	        list.add("2");
-	        list.add("3");
-	        for(int i=0; i<list.size();i++) {
-	            assertEquals("index of"+i,list.get(i),""+(i+1));
-	        }
-	    }
-
-	    @Test
-	    public void testSet() {
-	        assertEquals("init list size is 0  ", list.size(), 0);
-	        list.add("1");
-	        list.add("3");
-	        list.add("3");
-	        list.set(1, "2");
-	        for(int i=0; i<list.size();i++) {
-	            assertEquals("index of"+i,list.get(i),""+(i+1));
-	        }
-	    }
-
-	    @Test
-	    public void testSize() {
-	        assertEquals("init list size is 0  ", list.size(), 0);
-	        list.add("1");
-	        list.add("3");
-	        list.add("3");
-	        assertEquals("after add list size is ", list.size(),3);
-	    }
-
-	    /**
-	     * 正确的判空用例
-	     */
-	    @Test
-	    public void testIsEmpty() {
-	       assertEquals("list is empty", list.isEmpty(),true);
-	    }
-
-	    /**
-	     * 失败的判空用例
-	     */
-	    @Test
-	    public void testIsEmptyNot() {
-	        list.add("1");
-	        assertEquals("list is empty", list.isEmpty(),false);
-	    }
-}
diff --git a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyLinkedListTest.java b/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyLinkedListTest.java
deleted file mode 100644
index ac9945881..000000000
--- a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyLinkedListTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic; 
-
-import org.junit.Test; 
-import org.junit.Before; 
-import org.junit.After;
-
-import java.util.LinkedList;
-
-import static org.junit.Assert.assertEquals;
-
-/** 
-* MyLinkedList Tester. 
-* 
-* @author <Authors name> 
-* @since <pre>���� 26, 2017</pre> 
-* @version 1.0 
-*/ 
-public class MyLinkedListTest {
-    private MyLinkedList<String> linkedList;
-
-    @Before
-    public void before() throws Exception {
-        linkedList = new MyLinkedList<>();
-    }
-
-    @After
-    public void after() throws Exception {
-    }
-
-    /**
-    *
-    * Method: add(T t)
-    *
-    */
-    @Test
-    public void testAddT() throws Exception {
-        assertEquals("init list size is 0  ", linkedList.size(), 0);
-        linkedList.add("1");
-        linkedList.add("2");
-        assertEquals("add list size ", linkedList.size(), 2);
-        for (int i=0; i<linkedList.size(); i++) {
-            assertEquals("index of"+i,linkedList.get(i),""+(i+1));
-        }
-    }
-
-    /**
-    *
-    * Method: add(int index, T element)
-    *
-    */
-    @Test
-    public void testAddForIndexElement() throws Exception {
-//        linkedList.add("1");
-//        linkedList.add("3");
-//        linkedList.add(1,"2");
-//        assertEquals("add list size ", linkedList.size(), 3);
-//        for (int i=0; i<linkedList.size(); i++) {
-//            assertEquals("index of"+i,linkedList.get(i),""+(i+1));
-//        }
-    }
-
-    /**
-    *
-    * Method: get(int index)
-    *
-    */
-    @Test
-    public void testGet() throws Exception {
-        linkedList.add("1");
-        linkedList.add("2");
-        assertEquals("get methos; ",linkedList.get(0),"1" );
-    }
-
-    /**
-    *
-    * Method: set(int index, T newValue)
-    *
-    */
-    @Test
-    public void testSet() throws Exception {
-        linkedList.add("1");
-        linkedList.add("2");
-        linkedList.set(1, "3");
-        assertEquals("set mehtod ", linkedList.get(1),"3");
-    }
-
-    /**
-    *
-    * Method: remove(int index)
-    *
-    */
-    @Test
-    public void testRemove() throws Exception {
-        linkedList.add("1");
-        linkedList.add("2");
-        linkedList.remove(0);
-        assertEquals("remove methos", linkedList.size(),1);
-    }
-
-    /**
-    *
-    * Method: size()
-    *
-    */
-    @Test
-    public void testSize() throws Exception {
-    //TODO: Test goes here...
-    }
-
-    /**
-    *
-    * Method: isEmpty()
-    *
-    */
-    @Test
-    public void testIsEmpty() throws Exception {
-        assertEquals("isEmpth method ", linkedList.isEmpty(),true);
-    }
-
-
-} 
diff --git a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyQueueTest.java b/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyQueueTest.java
deleted file mode 100644
index ad1a09dba..000000000
--- a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyQueueTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic; 
-
-import org.junit.Test; 
-import org.junit.Before; 
-import static  org.junit.Assert.*;
-
-/** 
-* MyQueue Tester. 
-* 
-* @author <Authors name> 
-* @since <pre>���� 26, 2017</pre> 
-* @version 1.0 
-*/ 
-public class MyQueueTest {
-    private MyQueue<String> queue;
-
-    @Before
-    public void init() throws Exception {
-        queue = new MyQueue<>();
-    }
-
-    /**
-    *
-    * Method: enQueue(T t)
-    *
-    */
-    @Test
-    public void testEnQueue() throws Exception {
-        queue.enQueue("1");
-        assertEquals("size ", queue.size(), 1);
-    }
-
-    /**
-    *
-    * Method: deQueue()
-    *
-    */
-    @Test
-    public void testDeQueue() throws Exception {
-        queue.enQueue("1");
-        queue.enQueue("2");
-//        queue.deQueue();
-        assertEquals("dequeue element ",queue.deQueue(),"1");
-        assertEquals("size ", queue.size(), 1);
-
-    }
-
-    /**
-    *
-    * Method: isEmpty()
-    *
-    */
-    @Test
-    public void testIsEmpty() throws Exception {
-        assertEquals("isEmpty method",queue.isEmpty(),true);
-    }
-
-    /**
-    *
-    * Method: size()
-    *
-    */
-    @Test
-    public void testSize() throws Exception {
-        queue.enQueue("1");
-        queue.enQueue("2");
-        assertEquals("size method", queue.size(),2);
-    }
-
-
-} 
diff --git a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyStackTest.java b/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyStackTest.java
deleted file mode 100644
index a90af5d72..000000000
--- a/group02/435994736Learning/src/test/java/com/github/lhpmatlab/coding2017/basic/MyStackTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic; 
-
-import org.junit.Test; 
-import org.junit.Before; 
-import org.junit.After;
-
-import static org.junit.Assert.*;
-
-/** 
-* MyStack Tester. 
-* 
-* @author <Authors name> 
-* @since <pre>���� 26, 2017</pre> 
-* @version 1.0 
-*/ 
-public class MyStackTest {
-
-    MyStack<String> stack;
-
-
-    @Before
-    public void init() throws Exception {
-        stack = new MyStack<>();
-    }
-
-    @After
-    public void after() throws Exception {
-    }
-
-    /**
-    *
-    * Method: push(T t)
-    *
-    */
-    @Test
-    public void testPush() throws Exception {
-        assertEquals("init stack ", stack.size(), 0);
-        stack.push("1");
-        assertEquals("pust stack ", stack.size(),1);
-    }
-
-    /**
-    *
-    * Method: pop()
-    *
-    */
-    @Test
-    public void testPop() throws Exception {
-        assertEquals("init stack ", stack.size(), 0);
-        stack.push("1");
-        stack.push("2");
-        stack.pop();
-        assertEquals("after pop ",stack.size(),1);
-    }
-
-    /**
-    *
-    * Method: peek()
-    *
-    */
-    @Test
-    public void testPeek() throws Exception {
-        assertEquals("init stack ", stack.size(), 0);
-        stack.push("1");
-        stack.push("2");
-        assertEquals("peek ", stack.peek(),"2");
-    }
-
-    /**
-    *测试判空方法
-    * Method: isEmpty()
-    *
-    */
-    @Test
-    public void testIsEmpty() throws Exception {
-        assertEquals("stack is empty ", stack.isEmpty(), true);
-    }
-
-    /**
-     *测试判空方法,不为空的情况
-     * Method: isEmpty()
-     *
-     */
-    @Test
-    public void testIsNotEmpty() throws Exception {
-        stack.push("1");
-        assertEquals("stack is empty ", stack.isEmpty(), false);
-    }
-
-    /**
-    *
-    * Method: size()
-    *
-    */
-    @Test
-    public void testSize() throws Exception {
-        assertEquals("init stack ", stack.size(), 0);
-        stack.push("1");
-        stack.push("2");
-        assertEquals("size is 2", stack.size(), 2);
-    }
-
-
-} 
