Documentation
¶
Index ¶
- Constants
- type MultiSet
- func (ms *MultiSet) Begin() *SetIterator
- func (ms *MultiSet) Clear()
- func (ms *MultiSet) Contains(element interface{}) bool
- func (ms *MultiSet) Erase(element interface{})
- func (ms *MultiSet) Find(element interface{}) *SetIterator
- func (ms *MultiSet) First() *SetIterator
- func (ms *MultiSet) Insert(element interface{})
- func (ms *MultiSet) Last() *SetIterator
- func (ms *MultiSet) LowerBound(element interface{}) *SetIterator
- func (ms *MultiSet) Size() int
- func (ms *MultiSet) String() string
- func (ms *MultiSet) Traversal(visitor visitor.Visitor)
- type Option
- type Options
- type Set
- func (s *Set) Begin() *SetIterator
- func (s *Set) Clear()
- func (s *Set) Contains(element interface{}) bool
- func (s *Set) Diff(other *Set) *Set
- func (s *Set) Erase(element interface{})
- func (s *Set) Find(element interface{}) *SetIterator
- func (s *Set) First() *SetIterator
- func (s *Set) Insert(element interface{})
- func (s *Set) Intersect(other *Set) *Set
- func (s *Set) Last() *SetIterator
- func (s *Set) LowerBound(element interface{}) *SetIterator
- func (s *Set) Size() int
- func (s *Set) String() string
- func (s *Set) Traversal(visitor visitor.Visitor)
- func (s *Set) Union(other *Set) *Set
- type SetIterator
- func (iter *SetIterator) Clone() iterator.ConstIterator
- func (iter *SetIterator) Equal(other iterator.ConstIterator) bool
- func (iter *SetIterator) IsValid() bool
- func (iter *SetIterator) Next() iterator.ConstIterator
- func (iter *SetIterator) Prev() iterator.ConstBidIterator
- func (iter *SetIterator) Value() interface{}
Constants ¶
const (
Empty = 0
)
constants definition
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultiSet ¶
type MultiSet struct {
// contains filtered or unexported fields
}
MultiSet uses RbTress for internal data structure, and keys can bee repeated.
func (*MultiSet) Begin ¶
func (ms *MultiSet) Begin() *SetIterator
Begin returns the iterator with the minimum element in the MultiSet
func (*MultiSet) Contains ¶
Contains returns true if the passed element is in the MultiSet. otherwise returns false.
func (*MultiSet) Erase ¶
func (ms *MultiSet) Erase(element interface{})
Erase erases all node with passed element in the MultiSet
func (*MultiSet) Find ¶
func (ms *MultiSet) Find(element interface{}) *SetIterator
Find finds the first element that is equal to the passed element in the MultiSet, and returns its iterator
func (*MultiSet) First ¶
func (ms *MultiSet) First() *SetIterator
First returns the iterator with the minimum element in the MultiSet
func (*MultiSet) Insert ¶
func (ms *MultiSet) Insert(element interface{})
Insert inserts an element to the MultiSet
func (*MultiSet) Last ¶
func (ms *MultiSet) Last() *SetIterator
Last returns the iterator with the maximum element in the MultiSet
func (*MultiSet) LowerBound ¶
func (ms *MultiSet) LowerBound(element interface{}) *SetIterator
LowerBound finds the first element that is equal to or greater than the passed element in the MultiSet, and returns its iterator
type Option ¶
type Option func(option *Options)
Option is a function type used to set Options
func WithGoroutineSafe ¶
func WithGoroutineSafe() Option
WithGoroutineSafe is used to set the set goroutine-safe Note that iterators are not goroutine safe, and it is useless to turn on the setting option here. so don't use iterators in multi goroutines
func WithKeyComparator ¶
func WithKeyComparator(cmp comparator.Comparator) Option
WithKeyComparator is used to set the key comparator for a set
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options holds the Set's options
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set uses RbTress for internal data structure, and every key can must bee unique.
func (*Set) Begin ¶
func (s *Set) Begin() *SetIterator
Begin returns the iterator with the minimum element in the set
func (*Set) Contains ¶
Contains returns true if the passed element is in the Set. otherwise returns false.
func (*Set) Diff ¶
Diff returns a new set with the elements in the set s but not in the passed set Please ensure s set and other set uses the same keyCmp
func (*Set) Find ¶
func (s *Set) Find(element interface{}) *SetIterator
Find finds the element's node in the set, and return its iterator
func (*Set) First ¶
func (s *Set) First() *SetIterator
First returns the iterator with the minimum element in the set
func (*Set) Intersect ¶
Intersect returns a new set with the common elements in the set s and the passed set Please ensure s set and other set uses the same keyCmp
func (*Set) Last ¶
func (s *Set) Last() *SetIterator
Last returns the iterator with the maximum element in the set
func (*Set) LowerBound ¶
func (s *Set) LowerBound(element interface{}) *SetIterator
LowerBound finds the first element that equal or greater than the passed element in the set, and returns its iterator
type SetIterator ¶
type SetIterator struct {
// contains filtered or unexported fields
}
SetIterator is an iterator implementation of set
func (*SetIterator) Clone ¶
func (iter *SetIterator) Clone() iterator.ConstIterator
Clone clones the iterator into a new SetIterator
func (*SetIterator) Equal ¶
func (iter *SetIterator) Equal(other iterator.ConstIterator) bool
Equal returns true if the iterator is equal to the passed iterator
func (*SetIterator) IsValid ¶
func (iter *SetIterator) IsValid() bool
IsValid returns true if the iterator is valid, otherwise returns false
func (*SetIterator) Next ¶
func (iter *SetIterator) Next() iterator.ConstIterator
Next moves the pointer of the iterator to the next node and returns itself
func (*SetIterator) Prev ¶
func (iter *SetIterator) Prev() iterator.ConstBidIterator
Prev moves the pointer of the iterator to the previous node and returns itself
func (*SetIterator) Value ¶
func (iter *SetIterator) Value() interface{}
Value returns the element of the iterator point to