From 43059714ada0de61721218a6ee9b4dccf0284465 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=AD=E5=B7=9E-=E5=A4=A7=E6=98=8E?= <420355244@qq.com>
Date: Wed, 1 Mar 2017 22:02:26 +0800
Subject: [PATCH] delete old
---
group16/420355244/.classpath | 7 -
group16/420355244/.gitignore | 1 -
group16/420355244/.project | 17 --
.../src/com/coding/basic/ArrayList.java | 91 -------
.../src/com/coding/basic/ArrayListTest.java | 64 -----
.../src/com/coding/basic/BinaryTreeNode.java | 32 ---
.../src/com/coding/basic/Iterator.java | 7 -
.../src/com/coding/basic/LinkedList.java | 224 ------------------
.../src/com/coding/basic/LinkedListTest.java | 112 ---------
.../420355244/src/com/coding/basic/List.java | 9 -
.../420355244/src/com/coding/basic/Queue.java | 66 ------
.../src/com/coding/basic/QueueTest.java | 56 -----
.../420355244/src/com/coding/basic/Stack.java | 39 ---
.../src/com/coding/basic/StackTest.java | 64 -----
14 files changed, 789 deletions(-)
delete mode 100644 group16/420355244/.classpath
delete mode 100644 group16/420355244/.gitignore
delete mode 100644 group16/420355244/.project
delete mode 100644 group16/420355244/src/com/coding/basic/ArrayList.java
delete mode 100644 group16/420355244/src/com/coding/basic/ArrayListTest.java
delete mode 100644 group16/420355244/src/com/coding/basic/BinaryTreeNode.java
delete mode 100644 group16/420355244/src/com/coding/basic/Iterator.java
delete mode 100644 group16/420355244/src/com/coding/basic/LinkedList.java
delete mode 100644 group16/420355244/src/com/coding/basic/LinkedListTest.java
delete mode 100644 group16/420355244/src/com/coding/basic/List.java
delete mode 100644 group16/420355244/src/com/coding/basic/Queue.java
delete mode 100644 group16/420355244/src/com/coding/basic/QueueTest.java
delete mode 100644 group16/420355244/src/com/coding/basic/Stack.java
delete mode 100644 group16/420355244/src/com/coding/basic/StackTest.java
diff --git a/group16/420355244/.classpath b/group16/420355244/.classpath
deleted file mode 100644
index 3e0fb272a8..0000000000
--- a/group16/420355244/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/group16/420355244/.gitignore b/group16/420355244/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group16/420355244/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group16/420355244/.project b/group16/420355244/.project
deleted file mode 100644
index aec36208a6..0000000000
--- a/group16/420355244/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- Homework
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group16/420355244/src/com/coding/basic/ArrayList.java b/group16/420355244/src/com/coding/basic/ArrayList.java
deleted file mode 100644
index 6534c3c029..0000000000
--- a/group16/420355244/src/com/coding/basic/ArrayList.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.coding.basic;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o){
- if(size < elementData.length){
- elementData[size] = o;
- }else{
- Object[] newElementData = new Object[elementData.length + elementData.length/2];
- System.arraycopy(elementData, 0, newElementData, 0, size);
- newElementData[size] = o;
- this.elementData = newElementData;
- }
- size++;
-
- }
- public void add(int index, Object o){
- if(index >= 0 && index <= size){
- //1.不扩容
- if(index == size - 1){
- //1.1 加在最后
- elementData[index] = o;
- }else{
- //1.2 加在前面
- //index的位置的数值变为改对象,index以后位置的都往后挪一位
- Object[] newElementData = new Object[elementData.length];
- System.arraycopy(elementData, 0, newElementData, 0, index);
- newElementData[index] = o ;
- System.arraycopy(elementData, index, newElementData, index + 1, size - index);
- this.elementData = newElementData;
- }
- size++;
- }else{
- throw new IndexOutOfBoundsException();
- }
- }
-
- public Object get(int index){
- if(index < size){
- return elementData[index];
- }else{
- throw new IndexOutOfBoundsException();
- }
- }
-
- public Object remove(int index){
- if(index < size){
- Object obj = elementData[index];
- Object[] newElementData = new Object[elementData.length];
- if(size != 1){
- //1.若集合长度为1
- if(0 == index){
- //1.1.如果remove的是0索引的
- System.arraycopy(elementData, 1, newElementData, 0, size - 1);
- }else if(index == size -1){
- //1.2.如果remove的是最后索引的
- System.arraycopy(elementData, 0, newElementData, 0, size - 1);
- }else{
- //1.3.在中间
- System.arraycopy(elementData, 0, newElementData, 0, index);
- System.arraycopy(elementData, index + 1, newElementData, index, size - index - 1);
- }
- }
- this.elementData = newElementData;
- size--;
- return obj;
- }else{
- throw new IndexOutOfBoundsException();
- }
- }
-
- public int size(){
- return size;
- }
-
- public Iterator iterator(){
- return null;
- }
- @Override
- public String toString() {
- return "ArrayList [size=" + size + ", elementData=" + Arrays.toString(elementData) + "]";
- }
-
-
-}
diff --git a/group16/420355244/src/com/coding/basic/ArrayListTest.java b/group16/420355244/src/com/coding/basic/ArrayListTest.java
deleted file mode 100644
index 2f48bdf4c8..0000000000
--- a/group16/420355244/src/com/coding/basic/ArrayListTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.fail;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ArrayListTest {
-
- private static ArrayList arrayList = new ArrayList();
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void testAddObject() {
- for(int i = 0 ;i < 150; i++){
- arrayList.add("aaa");
- }
- System.out.println(arrayList);
- System.out.println(arrayList.size());
- }
-
- @Test
- public void testAddIntObject() {
- arrayList.add("aaa");
- arrayList.add("bbb");
- arrayList.add("ccc");
- arrayList.add("ddd");
- arrayList.add(1,"eee");
- System.out.println(arrayList);
- }
-
- @Test
- public void testGet() {
- arrayList.add("aaa");
- arrayList.add("bbb");
- arrayList.add("ccc");
- arrayList.add("ddd");
- Object object = arrayList.get(0);
- System.out.println(object);
- }
-
- @Test
- public void testRemove() {
- arrayList.add("aaa");
- arrayList.add("bbb");
- arrayList.add("ccc");
- arrayList.add("ddd");
- arrayList.remove(0);
- System.out.println(arrayList);
- }
-
- @Test
- public void testSize() {
- arrayList.add("aaa");
- arrayList.add("bbb");
- arrayList.add("ccc");
- arrayList.add("ddd");
- System.out.println(arrayList.size());
- }
-
-}
diff --git a/group16/420355244/src/com/coding/basic/BinaryTreeNode.java b/group16/420355244/src/com/coding/basic/BinaryTreeNode.java
deleted file mode 100644
index d7ac820192..0000000000
--- a/group16/420355244/src/com/coding/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.coding.basic;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public Object getData() {
- return data;
- }
- public void setData(Object data) {
- this.data = data;
- }
- public BinaryTreeNode getLeft() {
- return left;
- }
- public void setLeft(BinaryTreeNode left) {
- this.left = left;
- }
- public BinaryTreeNode getRight() {
- return right;
- }
- public void setRight(BinaryTreeNode right) {
- this.right = right;
- }
-
- public BinaryTreeNode insert(Object o){
- return null;
- }
-
-}
diff --git a/group16/420355244/src/com/coding/basic/Iterator.java b/group16/420355244/src/com/coding/basic/Iterator.java
deleted file mode 100644
index 06ef6311b2..0000000000
--- a/group16/420355244/src/com/coding/basic/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.coding.basic;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group16/420355244/src/com/coding/basic/LinkedList.java b/group16/420355244/src/com/coding/basic/LinkedList.java
deleted file mode 100644
index 9af35a399d..0000000000
--- a/group16/420355244/src/com/coding/basic/LinkedList.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package com.coding.basic;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
-
-
- private Node first;
-
- private Node last;
-
- private int size = 0;
-
- public void add(Object o){
- if(null == first){
- //当链表元素为空时,新建一个Node
- Node node = new Node();
- node.data = o;
- node.next = null;
- first = node;
- last = node;
- size ++;
- }else{
- addLast(o);
- }
- }
- public void add(int index , Object o){
- if(index < 0 || index >= size){
- //数组越界异常
- throw new IndexOutOfBoundsException();
- }else{
- if(0 == index){
- //1.如果加在头上
- addFirst(o);
- }else{
- //2.加在中间位置
- Node node = first.next;
- int nodeIndex = 1;
- if(nodeIndex == index){
- //如果是第二个位置的话
- Node nodeAdd = new Node();
- nodeAdd.data = o;
- first.next = nodeAdd;
- nodeAdd.next = node;
- last = node;
- size ++;
- }
- //第三个位置及以后、开始遍历所有的索引
- while(null != node.next){
- //保留遍历中node之前的结点
- Node nodeLast = node;
- node = node.next;
- nodeIndex++;
- if(nodeIndex == index){
- Node nodeAdd = new Node();
- nodeAdd.data = o;
- nodeLast.next = nodeAdd;
- nodeAdd.next = node;
- size ++;
- break;
- }
- }
- }
- }
-
- }
- public Object get(int index){
- if(index < 0 || index >= size){
- //数组越界异常
- throw new IndexOutOfBoundsException();
- }else{
- if(0 == index){
- //1.如果加在头上
- return first.data;
- }
- Node node = first.next;
- int nodeIndex = 1;
- if(nodeIndex == index){
- //如果是第二个位置的话
- return node.data;
- }
- //第三个位置及以后、开始遍历所有的索引
- while(null != node.next){
- //保留遍历中node之前的结点
- node = node.next;
- nodeIndex++;
- if(nodeIndex == index){
- return node.data;
- }
- }
- }
- throw new IndexOutOfBoundsException();
- }
- public Object remove(int index){
- if(index < 0 || index >= size){
- //数组越界异常
- throw new IndexOutOfBoundsException();
- }else{
- if(0 == index){
- //1.如果移除头
- removeFirst();
- }else if(index == (size - 1)){
- //2.移除尾
- removeLast();
- }else{
- //3.移除中间位置
- Node node = first.next;
- //从first的零号索引开始
- int nodeIndex = 1;
-
- //开始遍历所有的索引,记住要移除的索引位数据的前后结点
- Node lastNode = first;
- if(index == nodeIndex){
- //第一次不匹配则后续的循环执行
- Object o = node.data;
- lastNode.next = node.next;
- size--;
- return o;
- }else{
- while(null != node.next){
- lastNode = node;
- node = node.next;
- nodeIndex++;
- if(index == nodeIndex){
- Object o = node.data;
- lastNode.next = node.next;
- size--;
- return o;
- }
- }
- }
- }
- }
- throw new IndexOutOfBoundsException();
- }
-
- public int size(){
- return size;
- }
-
- public void addFirst(Object o){
- Node node = new Node();
- node.data = o ;
- node.next = first;
- first = node;
- size++;
- }
- public void addLast(Object o){
- Node node = new Node();
- node.data = o ;
- node.next = null;
- last.next = node;
- last = node;
- size++;
- }
- public Object removeFirst(){
- Object o = first.data;
- Node node = first.next;
- first = node;
- size--;
- return o;
- }
- public Object removeLast(){
- if(0 == size){
- throw new NoSuchElementException();
-
- }else if(1 == size){
- //只有一个元素
- removeFirst();
- }else{
- //第二个元素
- Node node = first.next;
- if(null == node.next){
- Object o = node.data;
- last = first;
- first.next = null;
- return o;
- }else{
- while(null != node.next){
- //若不止只有2个 ,记录最后一个结点的前一个。
- Node lastNode = node;
- node = node.next;
- if(null == node.next){
- Object o = node.data;
- lastNode.next = null;
- last = lastNode;
- size--;
- return o;
- }
- }
- }
- }
- throw new NoSuchElementException();
- }
- public Iterator iterator(){
- return null;
- }
-
-
- private static class Node{
- Object data;
- Node next;
-
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if(null != first){
- sb.append(first.data.toString() + ",");
- Node node = first.next;
- sb.append(node.data.toString() + ",");
- while(null != node.next){
- node = node.next;
- sb.append(node.data.toString() + ",");
- }
- }
- return sb.toString();
- }
-
-
-
-}
diff --git a/group16/420355244/src/com/coding/basic/LinkedListTest.java b/group16/420355244/src/com/coding/basic/LinkedListTest.java
deleted file mode 100644
index 2caea9679b..0000000000
--- a/group16/420355244/src/com/coding/basic/LinkedListTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class LinkedListTest {
- private static LinkedList linkedList = new LinkedList();
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void testAddObject() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- System.out.println(linkedList);
- }
-
- @Test
- public void testAddIntObject() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.add("ccc");
- linkedList.add(2,"ddd");
- System.out.println(linkedList);
- System.out.println(linkedList.size());
- }
-
- @Test
- public void testGet() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.add("ccc");
- linkedList.add("eee");
- linkedList.add("fff");
- linkedList.add("ddd");
-// System.out.println(linkedList.size());
- System.out.println(linkedList.get(3));
- }
-
- @Test
- public void testRemove() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.add("ccc");
- linkedList.add("eee");
- linkedList.add("fff");
- linkedList.add("ddd");
- linkedList.remove(5);
- linkedList.remove(1);
- linkedList.remove(2);
- System.out.println(linkedList);
- System.out.println(linkedList.size());
- }
-
- @Test
- public void testSize() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.add("ccc");
- linkedList.add("eee");
- linkedList.add("fff");
- linkedList.add("ddd");
- System.out.println(linkedList.size());
- }
-
- @Test
- public void testAddFirst() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.addFirst("sss");
- System.out.println(linkedList);
- }
-
- @Test
- public void testAddLast() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.add("ccc");
- System.out.println(linkedList);
- }
-
- @Test
- public void testRemoveFirst() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.add("ccc");
- linkedList.removeFirst();
- linkedList.addFirst("eee");
- linkedList.removeFirst();
- System.out.println(linkedList);
- }
-
- @Test
- public void testRemoveLast() {
- linkedList.add("aaa");
- linkedList.add("bbb");
- linkedList.add("ccc");
- linkedList.removeLast();
- linkedList.add("eee");
- linkedList.addFirst("xxx");
- System.out.println(linkedList);
- }
-
- @Test
- public void testIterator() {
- fail("Not yet implemented");
- }
-
-}
diff --git a/group16/420355244/src/com/coding/basic/List.java b/group16/420355244/src/com/coding/basic/List.java
deleted file mode 100644
index 10d13b5832..0000000000
--- a/group16/420355244/src/com/coding/basic/List.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.coding.basic;
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
-}
diff --git a/group16/420355244/src/com/coding/basic/Queue.java b/group16/420355244/src/com/coding/basic/Queue.java
deleted file mode 100644
index a2f9577b7b..0000000000
--- a/group16/420355244/src/com/coding/basic/Queue.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.coding.basic;
-
-public class Queue {
- private Node first;
- private Node last;
- private int size = 0;
- public void enQueue(Object o){
- if(null == first){
- Node node = new Node();
- node.data = o;
- node.next = null;
- first = node;
- last = node;
- }else{
- Node node = new Node();
- node.data = o;
- node.next = null;
- last.next = node;
- last = node;
- }
- size++;
- }
-
- public Object deQueue(){
- Node second = first.next;
- Object o = first.data;
- if(null != second){
- first = second;
- return o;
- }else{
- first = null;
- size = 0;
- return o;
- }
- }
-
- public boolean isEmpty(){
- if(size > 0){
- return false;
- }else{
- return true;
- }
- }
-
- public int size(){
- return size;
- }
- static class Node{
- Node next;
- Object data;
- }
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if(null != first){
- sb.append(first.data.toString() + ",");
- Node node = first.next;
- sb.append(node.data.toString() + ",");
- while(null != node.next){
- node = node.next;
- sb.append(node.data.toString() + ",");
- }
- }
- return sb.toString();
- }
-}
diff --git a/group16/420355244/src/com/coding/basic/QueueTest.java b/group16/420355244/src/com/coding/basic/QueueTest.java
deleted file mode 100644
index 50d7fc0903..0000000000
--- a/group16/420355244/src/com/coding/basic/QueueTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class QueueTest {
-
- public static Queue queue = new Queue();
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void testEnQueue() {
- queue.enQueue("aaa");
- queue.enQueue("bbb");
- queue.enQueue("ccc");
- queue.enQueue("aaa");
- System.out.println(queue);
- }
-
- @Test
- public void testDeQueue() {
- queue.enQueue("aaa");
- queue.enQueue("bbb");
- queue.enQueue("ccc");
- queue.enQueue("ddd");
- queue.enQueue("eee");
- queue.deQueue();
- System.out.println(queue);
- }
-
- @Test
- public void testIsEmpty() {
- System.out.println(queue.isEmpty());
-
- }
-
- @Test
- public void testSize() {
- queue.enQueue("aaa");
- queue.enQueue("bbb");
- queue.enQueue("ccc");
- queue.enQueue("ddd");
- queue.enQueue("eee");
- System.out.println(queue.size());
- }
-
- @Test
- public void testToString() {
- fail("Not yet implemented");
- }
-
-}
diff --git a/group16/420355244/src/com/coding/basic/Stack.java b/group16/420355244/src/com/coding/basic/Stack.java
deleted file mode 100644
index 5c59bf34fc..0000000000
--- a/group16/420355244/src/com/coding/basic/Stack.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.coding.basic;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
- private int size = 0;
- public void push(Object o){
- //入栈在栈顶进入最后压入
- elementData.add(o);
- size ++;
- }
-
- public Object pop(){
- Object object = elementData.get(size -1);
- elementData.remove(size -1);
- size --;
- return object;
- }
-
- public Object peek(){
- Object object = elementData.get(size -1);
- return object;
- }
- public boolean isEmpty(){
- if(size <= 0){
- return true;
- }else{
- return false;
- }
- }
- public int size(){
- return size;
- }
-
- @Override
- public String toString() {
- return elementData.toString();
- }
-
-}
diff --git a/group16/420355244/src/com/coding/basic/StackTest.java b/group16/420355244/src/com/coding/basic/StackTest.java
deleted file mode 100644
index 0628e7c76e..0000000000
--- a/group16/420355244/src/com/coding/basic/StackTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class StackTest {
- private static Stack stack = new Stack();
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void testPush() {
- stack.push("aaa");
- stack.push("bbb");
- stack.push("ccc");
- System.out.println(stack);
- }
-
- @Test
- public void testPop() {
- stack.push("aaa");
- stack.push("bbb");
- stack.push("ccc");
- Object pop = stack.pop();
- System.out.println(pop);
- System.out.println(stack);
- }
-
- @Test
- public void testPeek() {
- stack.push("aaa");
- stack.push("bbb");
- stack.push("ccc");
- Object peek = stack.peek();
- System.out.println(peek);
- }
-
- @Test
- public void testIsEmpty() {
- System.out.println(stack.isEmpty());
- stack.push("aaa");
- stack.push("bbb");
- stack.push("ccc");
- System.out.println(stack.isEmpty());
- stack.pop();
- stack.pop();
- stack.pop();
- System.out.println(stack.isEmpty());
- }
-
- @Test
- public void testSize() {
- stack.push("aaa");
- stack.push("bbb");
- stack.push("ccc");
- stack.pop();
- stack.pop();
- System.out.println(stack.size());
- }
-
-}