protected TempHashSet <K> CreateCopy() { // Copy existing data in FULLY NEW STRUCTURE SetEntry <K>[] table = this.table; TempHashSet <K> backupSet = new TempHashSet <K>(table.Length, this.loadFactor, delegate(K key, SetEntry <K> entry) { return(EqualKeys(key, entry)); }, delegate(K key) { return(ExtractHash(key)); }); for (int a = table.Length; a-- > 0;) { SetEntry <K> entry = table[a]; while (entry != null) { K key = GetKeyOfEntry(entry); if (key != null) { backupSet.Add(CloneKey(key)); } entry = GetNextEntry(entry); } } return(backupSet); }
public override bool Equals(Object obj) { if (obj == this) { return(true); } if (!(obj is SetEntry <K>)) { return(false); } SetEntry <K> other = (SetEntry <K>)obj; return(Object.Equals(Key, other.Key)); }
public override K GetKeyOfEntry(SetEntry <K> entry) { return(entry.Key); }
protected override int GetHashOfEntry(SetEntry <K> entry) { return(entry.Hash); }
protected override void EntryRemoved(SetEntry <K> entry) { size--; }
protected override void EntryAdded(SetEntry <K> entry) { size++; }
protected override SetEntry <K> CreateEntry(int hash, K key, SetEntry <K> nextEntry) { return(new SetEntry <K>(hash, nextEntry, key)); }
protected override void SetNextEntry(SetEntry <K> entry, SetEntry <K> nextEntry) { entry.NextEntry = nextEntry; }
public override SetEntry <K> GetNextEntry(SetEntry <K> entry) { return(entry.NextEntry as SetEntry <K>); }
protected override bool EqualKeys(K key, SetEntry <K> entry) { return(equalsKeysDelegate.Invoke(key, entry)); }
protected override void EntryRemoved(SetEntry <K> entry) { base.EntryRemoved(entry); SetChanged(); }
protected override bool EqualKeys(K key, SetEntry <K> entry) { return(Object.ReferenceEquals(key, entry.Key)); }
public SetEntry(int hash, SetEntry <K> nextEntry, K key) { this.hash = hash; this.NextEntry = nextEntry; this.key = key; }