Mercurial > hg > Database > jungle-sharp
view Main/jungle-main/data/treemap/EmptyNode.cs @ 35:f2ea780b3e80
fix
author | Kazuma Takeda |
---|---|
date | Wed, 22 Feb 2017 16:30:19 +0900 |
parents | 1f99e150f336 |
children |
line wrap: on
line source
using System.Collections.Generic; 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; } }