github.com/whatap/golib@v0.0.22/util/hmap/StringSetry.go (about)

     1  package hmap
     2  
     3  import (
     4  	"github.com/whatap/golib/util/stringutil"
     5  	//"fmt"
     6  )
     7  
     8  type StringSetry struct {
     9  	hash uint
    10  	key  string
    11  	next *StringSetry
    12  }
    13  
    14  func NewStringSetry(hash uint, key string, next *StringSetry) *StringSetry {
    15  	p := new(StringSetry)
    16  	p.hash = hash
    17  	p.key = key
    18  	p.next = next
    19  	return p
    20  }
    21  func (this *StringSetry) Clone() *StringSetry {
    22  	var n *StringSetry
    23  	if this.next == nil {
    24  		n = nil
    25  	} else {
    26  		n = this.next.Clone()
    27  	}
    28  	return NewStringSetry(this.hash, this.key, n)
    29  }
    30  
    31  func (this *StringSetry) GetKey() string {
    32  	return this.key
    33  }
    34  
    35  func (this *StringSetry) Get() string {
    36  	return this.key
    37  }
    38  
    39  //func (this *StringSetry) Equals(o interface{}) bool{
    40  //	var e *StringSetry
    41  //	switch o.(type){
    42  //		case StringSetry:
    43  //			e = o.(*StringSetry)
    44  //		default:
    45  //			return false
    46  //	}
    47  //	if e.GetKey() == this.key {
    48  //		return true
    49  //	}else {
    50  //		return false
    51  //	}
    52  //}
    53  
    54  func (this *StringSetry) Equals(o *StringSetry) bool {
    55  	return this.key == o.key
    56  }
    57  
    58  func (this *StringSetry) HashCode() uint {
    59  	return uint(stringutil.HashCode(this.key))
    60  }
    61  
    62  func (this *StringSetry) ToString() string {
    63  	return this.key
    64  }