BTree{*} .Empty

master
Harald Wolff 2020-01-07 08:52:05 +01:00
parent a17b1e21c7
commit a4e9f27c6e
3 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,7 @@ namespace ln.types.btree
{ {
public Comparison<K> Comparison { get; } public Comparison<K> Comparison { get; }
public int Count => count; public int Count => count;
public bool Empty => count == 0;
public int LeftDepth => headNode != null ? headNode.LeftDepth : 0; public int LeftDepth => headNode != null ? headNode.LeftDepth : 0;
public int RightDepth => headNode != null ? headNode.RightDepth : 0; public int RightDepth => headNode != null ? headNode.RightDepth : 0;

View File

@ -5,6 +5,8 @@ namespace ln.types.btree
{ {
public class BTreeValueList<K, V> public class BTreeValueList<K, V>
{ {
public bool Empty => bTree.Empty;
BTree<K, List<V>> bTree; BTree<K, List<V>> bTree;
public BTreeValueList() public BTreeValueList()
@ -131,6 +133,9 @@ namespace ln.types.btree
throw new Exception("Serious BUG"); throw new Exception("Serious BUG");
} }
public K First => bTree.First();
public K Last => bTree.Last();
public IEnumerable<K> Keys => bTree.Keys; public IEnumerable<K> Keys => bTree.Keys;

3
cache/Cache.cs vendored
View File

@ -1,6 +1,7 @@
using System; using System;
using ln.types.btree; using ln.types.btree;
using ln.types.collections; using ln.types.collections;
using ln.types.odb.ng.storage;
namespace ln.types.cache namespace ln.types.cache
{ {
public class Cache<K,V> public class Cache<K,V>
@ -11,7 +12,7 @@ namespace ln.types.cache
BTree<K, LinkedListItem<K>> itemTree; BTree<K, LinkedListItem<K>> itemTree;
LinkedList<K> items = new LinkedList<K>(); LinkedList<K> items = new LinkedList<K>();
int maxCacheSize = 4096; int maxCacheSize = 4096;
public Cache() public Cache()
{ {