0
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
1
|
3 using System.Collections.Generic;
|
0
|
4 using System;
|
|
5
|
|
6 public class EmptyNode<K,V> : TreeMapNode<K,V>{
|
1
|
7 //static V values;
|
0
|
8 // Use this for initialization
|
|
9 public EmptyNode ()
|
|
10 : base (default(K),default(V))
|
|
11 {
|
|
12 }
|
|
13
|
|
14 public EmptyNode (K key)
|
1
|
15 : base (key,default(V))
|
0
|
16 {
|
|
17 }
|
|
18
|
1
|
19 public override TreeMapNode<K,V> lefts(){
|
0
|
20 return new EmptyNode<K,V>();
|
|
21 }
|
|
22
|
1
|
23 public override TreeMapNode<K,V> rights(){
|
0
|
24 return new EmptyNode<K,V>();
|
|
25 }
|
|
26
|
|
27 public override bool isNotEmpty(){
|
|
28 return false;
|
|
29 }
|
|
30
|
6
|
31 public override TreeMapNode<K,V> createNode(K key,V value,TreeMapNode<K,V> left, TreeMapNode<K,V> right){
|
0
|
32 return new RedNode<K,V> (key, value, new EmptyNode<K,V> (), new EmptyNode<K,V> ());
|
|
33 }
|
|
34
|
|
35 public TreeMapNode<K,V> put(K k,V value){
|
|
36 return new RedNode<K, V> (k, value, new EmptyNode<K,V> (), new EmptyNode<K,V> ());
|
|
37 }
|
|
38
|
|
39 //I don't know only Comparator method.
|
1
|
40 public override rebuildNode<K, V> replaceNode(TreeMapNode<K, V> parent, Comparer<K> ctr) { // not use method
|
0
|
41 return new rebuildNode<K,V>(false, this);
|
|
42 }
|
|
43
|
|
44 public override rebuildNode<K,V> deleteNode(){
|
|
45 return new rebuildNode<K, V> (false, this);
|
|
46 }
|
|
47
|
|
48 public override TreeMapNode<K,V> insBalance(){
|
|
49 return insBalance();
|
|
50 }
|
|
51
|
|
52 public override Rotate checkRotate(Rotate side){
|
|
53 return Rotate.N;
|
|
54 }
|
|
55
|
|
56 public override bool isRed(){
|
|
57 return false;
|
|
58 }
|
|
59
|
|
60 public override int checkDepth(int count, int minCount) { // test method
|
1
|
61 if (count < minCount || minCount == 0) {
|
0
|
62 minCount = count;
|
1
|
63 }
|
|
64 //c# is there assert??
|
|
65 //Assert.assertTrue(count <= 2 * minCount);
|
0
|
66 return minCount;
|
|
67 }
|
|
68
|
|
69 }
|