view src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/data/treemap/EmptyNode.cs @ 6:4d08270a61c8

fix
author Kazuma
date Tue, 19 Jul 2016 16:47:43 +0900
parents 5c58219da97e
children
line wrap: on
line source

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;
	}

}