/// <summary> /// Tries to find an item on the table. /// </summary> /// <param name="dataAccessor">Data accessor</param> /// <param name="item">Item, if found</param> /// <param name="data">Data, if found</param> /// <returns>True if the item was found on the table, false otherwise</returns> public bool TryFindItem(IDataAccessor dataAccessor, out T item, out byte[] data) { SmartDataAccessor sda = new SmartDataAccessor(dataAccessor); item = default; data = null; int left = 0; int right = _sizeTable.Count; while (left != right) { int index = left + ((right - left) >> 1); PartitionHashTable <T> .SearchResult result = _sizeTable[index].TryFindItem(ref sda, ref item, ref data); if (result == PartitionHashTable <T> .SearchResult.FoundFull) { return(true); } if (result == PartitionHashTable <T> .SearchResult.NotFound) { right = index; } else /* if (result == PartitionHashTable<T>.SearchResult.FoundPartial) */ { left = index + 1; } } data = null; return(false); }
/// <summary> /// Tries to find an item on the hash table. /// </summary> /// <param name="dataAccessor">Data accessor</param> /// <param name="item">The item on the table, if found, otherwise unmodified</param> /// <param name="data">The data on the table, if found, otherwise unmodified</param> /// <returns>Table lookup result</returns> public PartitionHashTable <T> .SearchResult TryFindItem(ref SmartDataAccessor dataAccessor, ref T item, ref byte[] data) { return(_table.TryFindItem(ref dataAccessor, Size, ref item, ref data)); }