public override IndexSampler CreateSampler() { // For a unique index there's an optimization, knowing that all values in it are unique, to simply count // the number of indexed values and create a sample for that count. The GBPTree doesn't have an O(1) // count mechanism, it will have to manually count the indexed values in it to get it. // For that reason this implementation opts for keeping complexity down by just using the existing // non-unique sampler which scans the index and counts (potentially duplicates, of which there will // be none in a unique index). FullScanNonUniqueIndexSampler <KEY, VALUE> sampler = new FullScanNonUniqueIndexSampler <KEY, VALUE>(Tree, Layout); return(sampler.result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldIncludeAllValuesInTree() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldIncludeAllValuesInTree() { // GIVEN Value[] values = GenerateNumberValues(); BuildTree(values); // WHEN IndexSample sample; using (GBPTree <NumberIndexKey, NativeIndexValue> gbpTree = Tree) { FullScanNonUniqueIndexSampler <NumberIndexKey, NativeIndexValue> sampler = new FullScanNonUniqueIndexSampler <NumberIndexKey, NativeIndexValue>(gbpTree, Layout); sample = sampler.Result(); } // THEN assertEquals(values.Length, sample.SampleSize()); assertEquals(countUniqueValues(values), sample.UniqueValues()); assertEquals(values.Length, sample.IndexSize()); }