Mercurial > hg > Database > jungle-sharp
view src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/list/DefaultNode.cs @ 2:a3af05a061b4
fix , but not work.
author | Kazuma |
---|---|
date | Fri, 01 Jul 2016 19:28:57 +0900 |
parents | dec15de2c6ff |
children | 79da77797f7e |
line wrap: on
line source
using UnityEngine; using System.Collections; using System; public class DefaultNode<T> : Node<T> { private T attribute; private Node<T> next; //private TailNode<T> tailNode; private T attribute2; private Node<T> next1; public DefaultNode(T attribute, Node<T> next) { this.attribute = attribute; this.next = next; } // public DefaultNode(Node<T> attribute1, TailNode<T> tailNode) // { // this.attribute1 = attribute1; // this.tailNode = tailNode; // } public Node<T> getNext() { return next; } public T getAttribute() { return attribute; } public Node<T> addLast(T attribute) { Node<T> node = next.addLast(attribute); return new DefaultNode<T>(this.attribute, node); } public Node<T> add(int currentNum, int num, T attribute) { Node<T> newNode; if (currentNum == num) { newNode = new DefaultNode<T>(attribute, this.next); return new DefaultNode<T>(this.attribute, newNode); } newNode = next.add(currentNum + 1, num, attribute); if (newNode == null) return null; return new DefaultNode<T>(this.attribute, newNode); } public Node<T> delete(int currentNum, int deleteNum) { if (currentNum == deleteNum) { return new DefaultNode<T> (this.attribute, this.next.getNext ()); } Node<T> newNode = next.delete (currentNum + 1, deleteNum); if (newNode == null) { return null; } return new DefaultNode<T>(this.attribute, newNode); } public Node<T> replaceNode(int currentNum, int num, T attribute) { if (currentNum == num) { return new DefaultNode<T>(attribute, this.getNext()); } Node<T> newNode = next.replaceNode(currentNum + 1, num, attribute); if (newNode == null) { return null; } return new DefaultNode<T>(this.attribute, newNode); } public int length() { return next.length() + 1; } public T getAttribure() { throw new NotImplementedException(); } }