diff src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyNode.cs @ 0:dec15de2c6ff

first commit
author Kazuma
date Tue, 21 Jun 2016 17:11:12 +0900
parents
children 5c58219da97e
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/data/treemap/EmptyNode.cs	Tue Jun 21 17:11:12 2016 +0900
@@ -0,0 +1,68 @@
+using UnityEngine;
+using System.Collections;
+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,values)
+	{
+	}
+
+	public TreeMapNode<K,V> left(){
+		return new EmptyNode<K,V>();
+	}
+
+	public TreeMapNode<K,V> right(){
+		return new EmptyNode<K,V>();
+	}
+
+	public override bool isNotEmpty(){
+		return false;
+	}
+
+	public override TreeMapNode<K,V> createNode(K k,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 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;
+		Debug.Log("depth = " + count);
+		//c# is there assert??
+		//Assert.assertTrue(count <= 2 * minCount);
+		return minCount;
+	}
+
+}