public bool Remove(NAW naw) { int hashVal = naw.GetHashCode(); hashVal = hashVal % _array.Size; if (hashVal < 0) { hashVal = Math.Abs(hashVal); } while (_array[hashVal] != null) { if (_array[hashVal].CompareTo(naw) == 0) { _array[hashVal] = null; return(true); } hashVal++; hashVal = hashVal % _array.Size; } return(false); }
public bool Add(NAW naw) { if (_count < _array.Size) { int hashVal = naw.GetHashCode(); hashVal = hashVal % _array.Size; if (hashVal < 0) { hashVal = Math.Abs(hashVal); } while (_array[hashVal] != null) { hashVal++; hashVal = hashVal % _array.Size; } _array[hashVal] = naw; _count++; return(true); } return(false); }