コード例 #1
0
ファイル: collection.go プロジェクト: mervin0502/SalonRabbit
// Returns the entry associated with the specified key in the
// Collection.  Returns nil if the Collection contains no mapping
// for the key.
func (c Collection) getEntry(key *engine.ObjectIndex) *entry {
	//hashCode := 0
	//if key != nil {
	//	hashCode = hash(key.HashCode())
	//}
	h := hash(key.GetId())
	es := c.table[indexFor(h, c.capacity)]
	if es == nil {
		return nil
	}
	for e := es.head; e != nil; e = e.next {
		if e.hashCode == key.LocalHash() && e.key == key.LocalIndex() {
			return e
		}

	}
	return nil
}