util

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2018 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitSet

type BitSet interface {
	// Clear used for set the bit specified by the index to false.
	Clear(index int)
	// Set used for set the bit at the specified index to true.
	Set(index int)
	// Get returns the value of the bit with the specified index.
	// The value is true if the bit with the index is currently set in this BitSet;
	// otherwise, the result is false.
	Get(index int) bool
	// IsEmpty returns true if this BitSet contains no bits that are set to true.
	IsEmpty() bool
	// Reset clean all bit.
	Reset()
}

BitSet is the interface wraps method for BitSet data structure implementation.

func NewByteSliceBitSet

func NewByteSliceBitSet() BitSet

NewByteSliceBitSet create a new instance of byteSliceBitSet.

type Set added in v0.2.0

type Set interface {
	// Add the specified element to this set if it is not already present.
	Add(element interface{})
	// Remove the specified element from this set if it is present.
	Remove(element interface{})
	// Contains returns true if this set contains the specified element.
	Contains(element interface{}) bool
	// IsEmpty returns true if this set contains no elements.
	IsEmpty() bool
	// Size returns the number of elements in this set.
	Size() int
	// Range calls f sequentially for each key and value present in the set.
	// If f returns false, range stops the iteration.
	Range(f func(element interface{}) bool)
	// Clear removes all of the elements from this set.
	Clear()
	// Intersection returns a Set with intersection elements between this Set and specified Set.
	Intersection(set Set) Set
	// Union returns a Set with union elements between this Set and specified Set.
	Union(set Set) Set
}

Set is a interface defined a collection that contains no duplicate elements.

func NewSet added in v0.2.0

func NewSet(safe bool) Set

NewSet create a new instance of Set. If the safe parameter is true, returns a new instance of SafeHashSet, or HashSet.

type URL added in v0.2.0

type URL struct {
	Protocol string
	User     string
	Password string
	Host     string
	Port     int
	Path     string
	Param    map[string]string
}

URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web.

func ParseUrl added in v0.2.0

func ParseUrl(src string) URL

ParseUrl parse url data from string and returns a new URL instance.

func (*URL) Parse added in v0.2.0

func (url *URL) Parse(src string)

ParseUrl parse url instance from string.

func (*URL) String added in v0.2.0

func (url *URL) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL