Mercurial > hg > Database > jungle-sharp
changeset 5:0428c8888abf
Comparison original java code
author | Kazuma |
---|---|
date | Tue, 05 Jul 2016 07:20:41 +0900 |
parents | 79da77797f7e |
children | 4d08270a61c8 02b2ab7bffe6 |
files | src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/headNode.cs |
diffstat | 2 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs Mon Jul 04 03:50:34 2016 +0900 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs Tue Jul 05 07:20:41 2016 +0900 @@ -33,17 +33,16 @@ } public Node<T> add(int currentNum, int num, T attribute) { - Node<T> newNode; if (currentNum == num) { - newNode = new DefaultNode<T>(attribute, this.next); + Node<T> newNode = new DefaultNode<T>(attribute, this.next); return new DefaultNode<T>(this.attribute, newNode); } - newNode = next.add(currentNum + 1, num, attribute); - if (newNode == null) + Node<T> newNodes = next.add(currentNum + 1, num, attribute); + if (newNodes == null) return null; - return new DefaultNode<T>(this.attribute, newNode); + return new DefaultNode<T>(this.attribute, newNodes); } public Node<T> delete(int currentNum, int deleteNum) {
--- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/headNode.cs Mon Jul 04 03:50:34 2016 +0900 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/headNode.cs Tue Jul 05 07:20:41 2016 +0900 @@ -22,16 +22,15 @@ } public Node<T> add(int currentNum, int num, T attribute) { - Node<T> newNode; if (num == 0) { - newNode = new DefaultNode<T>(attribute, next); + Node<T> newNode = new DefaultNode<T>(attribute, next); return new headNode<T>(newNode); } - newNode = next.add(currentNum + 1, num, attribute); - if (newNode == null) { + Node<T> newNodes = next.add(currentNum + 1, num, attribute); + if (newNodes == null) { return this; } - return new headNode<T>(newNode); + return new headNode<T>(newNodes); } public Node<T> addLast(T attribute) {