//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public boolean next() throws java.io.IOException public virtual bool Next() { if (_readEntries >= _entryCount) { return(false); } BlockEntry.Read(_pageCursor, _layout, _key, _value); _readEntries++; return(true); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReadWriteMultipleEntries() internal virtual void ShouldReadWriteMultipleEntries() { IList <BlockEntry <MutableLong, MutableLong> > expectedEntries = new List <BlockEntry <MutableLong, MutableLong> >(); int nbrOfEntries = 10; int offset = _pageCursor.Offset; for (int i = 0; i < nbrOfEntries; i++) { BlockEntry <MutableLong, MutableLong> entry = new BlockEntry <MutableLong, MutableLong>(_layout.key(Rnd.nextLong()), _layout.value(Rnd.nextLong())); BlockEntry.Write(_pageCursor, _layout, entry); expectedEntries.Add(entry); } _pageCursor.Offset = offset; foreach (BlockEntry <MutableLong, MutableLong> expectedEntry in expectedEntries) { BlockEntry <MutableLong, MutableLong> actualEntry = BlockEntry.Read(_pageCursor, _layout); AssertBlockEquals(expectedEntry, actualEntry); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReadWriteSingleEntry() internal virtual void ShouldReadWriteSingleEntry() { // given MutableLong writeKey = _layout.key(Rnd.nextLong()); MutableLong writeValue = _layout.value(Rnd.nextLong()); int offset = _pageCursor.Offset; BlockEntry.Write(_pageCursor, _layout, writeKey, writeValue); // when MutableLong readKey = _layout.newKey(); MutableLong readValue = _layout.newValue(); _pageCursor.Offset = offset; BlockEntry.Read(_pageCursor, _layout, readKey, readValue); // then assertEquals(0, _layout.Compare(writeKey, readKey)); assertEquals(0, _layout.Compare(writeValue, readValue)); }
public static void Read <KEY, VALUE>(PageCursor cursor, Layout <KEY, VALUE> layout, UpdateMode updateMode, KEY key1, KEY key2, VALUE value) { switch (updateMode.innerEnumValue) { case UpdateMode.InnerEnum.ADDED: BlockEntry.Read(cursor, layout, key1, value); break; case UpdateMode.InnerEnum.REMOVED: BlockEntry.Read(cursor, layout, key1); break; case UpdateMode.InnerEnum.CHANGED: BlockEntry.Read(cursor, layout, key1); BlockEntry.Read(cursor, layout, key2, value); break; default: throw new System.ArgumentException("Unknown update mode " + updateMode); } }