示例#1
0
 internal EncodingIdMapper(NumberArrayFactory cacheFactory, Encoder encoder, Factory <Radix> radixFactory, Monitor monitor, TrackerFactory trackerFactory, Groups groups, System.Func <long, CollisionValues> collisionValuesFactory, int chunkSize, int processorsForParallelWork, Comparator comparator)
 {
     this._radixFactory              = radixFactory;
     this._monitor                   = monitor;
     this._cacheFactory              = cacheFactory;
     this._trackerFactory            = trackerFactory;
     this._collisionValuesFactory    = collisionValuesFactory;
     this._comparator                = comparator;
     this._processorsForParallelWork = max(processorsForParallelWork, 1);
     this._dataCache                 = cacheFactory.NewDynamicLongArray(chunkSize, GAP_VALUE);
     this._groupCache                = GroupCache.select(cacheFactory, chunkSize, groups.Size());
     this._groups  = groups;
     this._encoder = encoder;
     this._radix   = radixFactory.NewInstance();
 }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleSingleByteCount()
        public virtual void ShouldHandleSingleByteCount()
        {
            // given
            int        max   = 256;
            GroupCache cache = GroupCache.select(HEAP, 100, max);

            // when
            AssertSetAndGet(cache, 10, 45);
            AssertSetAndGet(cache, 100, 145);
            AssertSetAndGet(cache, 1000, 245);

            // then
            try
            {
                cache.Set(10000, 345);
                fail("Shouldn't handle that");
            }
            catch (ArithmeticException)
            {
                // OK
            }
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSwitchToTwoByteVersionBeyondSingleByteGroupIds()
        public virtual void ShouldSwitchToTwoByteVersionBeyondSingleByteGroupIds()
        {
            // given
            int        max   = 257;
            GroupCache cache = GroupCache.select(HEAP, 100, max);

            // when
            AssertSetAndGet(cache, 10, 123);
            AssertSetAndGet(cache, 100, 1234);
            AssertSetAndGet(cache, 1000, 12345);
            AssertSetAndGet(cache, 10000, 0xFFFF);

            // then
            try
            {
                cache.Set(100000, 123456);
                fail("Shouldn't handle that");
            }
            catch (ArithmeticException)
            {
                // OK
            }
        }