示例#1
0
        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);
        }
示例#2
0
文件: SetEntry.cs 项目: vogelb/ambeth
        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));
        }
示例#3
0
文件: CHashSet.cs 项目: vogelb/ambeth
 public override K GetKeyOfEntry(SetEntry <K> entry)
 {
     return(entry.Key);
 }
示例#4
0
文件: CHashSet.cs 项目: vogelb/ambeth
 protected override int GetHashOfEntry(SetEntry <K> entry)
 {
     return(entry.Hash);
 }
示例#5
0
文件: CHashSet.cs 项目: vogelb/ambeth
 protected override void EntryRemoved(SetEntry <K> entry)
 {
     size--;
 }
示例#6
0
文件: CHashSet.cs 项目: vogelb/ambeth
 protected override void EntryAdded(SetEntry <K> entry)
 {
     size++;
 }
示例#7
0
文件: CHashSet.cs 项目: vogelb/ambeth
 protected override SetEntry <K> CreateEntry(int hash, K key, SetEntry <K> nextEntry)
 {
     return(new SetEntry <K>(hash, nextEntry, key));
 }
示例#8
0
文件: CHashSet.cs 项目: vogelb/ambeth
 protected override void SetNextEntry(SetEntry <K> entry, SetEntry <K> nextEntry)
 {
     entry.NextEntry = nextEntry;
 }
示例#9
0
文件: CHashSet.cs 项目: vogelb/ambeth
 public override SetEntry <K> GetNextEntry(SetEntry <K> entry)
 {
     return(entry.NextEntry as SetEntry <K>);
 }
示例#10
0
 protected override bool EqualKeys(K key, SetEntry <K> entry)
 {
     return(equalsKeysDelegate.Invoke(key, entry));
 }
示例#11
0
 protected override void EntryRemoved(SetEntry <K> entry)
 {
     base.EntryRemoved(entry);
     SetChanged();
 }
示例#12
0
 protected override bool EqualKeys(K key, SetEntry <K> entry)
 {
     return(Object.ReferenceEquals(key, entry.Key));
 }
示例#13
0
文件: SetEntry.cs 项目: vogelb/ambeth
 public SetEntry(int hash, SetEntry <K> nextEntry, K key)
 {
     this.hash      = hash;
     this.NextEntry = nextEntry;
     this.key       = key;
 }