Ejemplo n.º 1
0
        private static sbyte[][] SortedUpdates <Key>(KeyFormat <Key> keys, ConcurrentMap <Key, ChangeEntry> changes)
        {
            Entry[] buffer = new Entry[changes.size()];
            IEnumerator <KeyValuePair <Key, ChangeEntry> > entries = changes.entrySet().GetEnumerator();

            for (int i = 0; i < buffer.Length; i++)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                KeyValuePair <Key, ChangeEntry> next = entries.next();                        // we hold the lock, so this should succeed
                sbyte[] key = new sbyte[keys.KeySize()];
                keys.WriteKey(next.Key, new BigEndianByteArrayBuffer(key));
                buffer[i] = new Entry(key, next.Value.data);
            }
            Arrays.sort(buffer);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            Debug.Assert(!entries.hasNext(), "We hold the lock, so we should see 'size' entries.");
            sbyte[][] result = new sbyte[buffer.Length * 2][];
            for (int i = 0; i < buffer.Length; i++)
            {
                result[i * 2]     = buffer[i].Key;
                result[i * 2 + 1] = buffer[i].Value;
            }
            return(result);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static <Key> DataProvider dataProvider(ReadableState<Key> store, java.util.concurrent.ConcurrentMap<Key, ChangeEntry> changes) throws java.io.IOException
        private static DataProvider DataProvider <Key>(ReadableState <Key> store, ConcurrentMap <Key, ChangeEntry> changes)
        {
            if (changes.Empty)
            {
                return(store.DataProvider());
            }
            else
            {
                KeyFormat <Key> keys = store.KeyFormat();
                return(new KeyValueMerger(store.DataProvider(), new UpdateProvider(SortedUpdates(keys, changes)), keys.KeySize(), keys.ValueSize()));
            }
        }