Mercurial > hg > Database > jungle-sharp
diff src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyNode.cs @ 10:abe0c247f5a5
Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
author | Kazuma Takeda <kazuma-arashi@hotmail.co.jp> |
---|---|
date | Sun, 23 Oct 2016 07:40:50 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/data/treemap/EmptyNode.cs Sun Oct 23 07:40:50 2016 +0900 @@ -0,0 +1,69 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +public class EmptyNode<K,V> : TreeMapNode<K,V>{ + //static V values; + // Use this for initialization + public EmptyNode () + : base (default(K),default(V)) + { + } + + public EmptyNode (K key) + : base (key,default(V)) + { + } + + public override TreeMapNode<K,V> lefts(){ + return new EmptyNode<K,V>(); + } + + public override TreeMapNode<K,V> rights(){ + return new EmptyNode<K,V>(); + } + + public override bool isNotEmpty(){ + return false; + } + + public override TreeMapNode<K,V> createNode(K key,V value,TreeMapNode<K,V> left, TreeMapNode<K,V> right){ + return new RedNode<K,V> (key, value, new EmptyNode<K,V> (), new EmptyNode<K,V> ()); + } + + public TreeMapNode<K,V> put(K k,V value){ + return new RedNode<K, V> (k, value, new EmptyNode<K,V> (), new EmptyNode<K,V> ()); + } + + //I don't know only Comparator method. + public override rebuildNode<K, V> replaceNode(TreeMapNode<K, V> parent, Comparer<K> ctr) { // not use method + return new rebuildNode<K,V>(false, this); + } + + public override rebuildNode<K,V> deleteNode(){ + return new rebuildNode<K, V> (false, this); + } + + public override TreeMapNode<K,V> insBalance(){ + return insBalance(); + } + + public override Rotate checkRotate(Rotate side){ + return Rotate.N; + } + + public override bool isRed(){ + return false; + } + + public override int checkDepth(int count, int minCount) { // test method + if (count < minCount || minCount == 0) { + minCount = count; + } + //c# is there assert?? + //Assert.assertTrue(count <= 2 * minCount); + return minCount; + } + +}