Documentation ¶
Overview ¶
Package utils provides utility functions and types that are needed in elprep.
Index ¶
Constants ¶
const ( // ProgramName is "elprep" ProgramName = "elprep" // ProgramVersion is the version of the elprep binary ProgramVersion = "5.1.3" // ProgramURL is the repository for the elprep source code ProgramURL = "http://github.com/exascience/elprep" )
Variables ¶
This section is empty.
Functions ¶
func Find ¶
Find returns the first index in a slice of StringMap where the predicate returns true, or -1 if predicate never returns true.
func HandleBGZF ¶
HandleBGZF checks if the given reader produces a gzip file by looking at the initial byte. It then either returns a bgzf.Reader, or returns the given reader unchanged. HandleBGZF uses ReadByte und UnreadByte.
func SymbolHash ¶
SymbolHash computes a hash value for the given Symbol.
Types ¶
type SmallMap ¶
type SmallMap []SmallMapEntry
A SmallMap maps keys to values, similar to Go's built-in maps. A SmallMap can be more efficient in terms of memory and runtime performance than a native map if it has only few entries. SmallMap keys are always symbols.
func (*SmallMap) Delete ¶
Delete removes the first entry from a SmallMap that has the same key as the given key.
It also returns true if an entry was removed, and false if no entry was removed because there was no entry for the given key.
func (*SmallMap) DeleteIf ¶
DeleteIf removes all entries from a SmallMap that satisfy the given test.
It also returns true if any entry was removed, and false if no entry was removed because no entry matched the given test.
func (SmallMap) Get ¶
Get returns the first entry in the SmallMap that has the same key as the given key.
It returns the found value and true if the key was found, otherwise nil and false.
type SmallMapEntry ¶
type SmallMapEntry struct { Key Symbol Value interface{} }
SmallMapEntry is an entry in a SmallMap.
type StringMap ¶
A StringMap maps strings to strings.
func (StringMap) SetUniqueEntry ¶
SetUniqueEntry checks if a mapping for the given key already exists in the StringMap. If this is the case, it returns false and the StringMap is not modified. Otherwise, the given key/value pair is added to the StringMap.
type Symbol ¶
type Symbol *string
A Symbol is a unique pointer to a string.
func Intern ¶
Intern returns a Symbol for the given string.
It always returns the same pointer for strings that are equal, and different pointers for strings that are not equal. So for two strings s1 and s2, if s1 == s2, then Intern(s1) == Intern(s2), and if s1 != s2, then Intern(s1) != Intern(s2).
Dereferencing the pointer always yields a string that is equal to the original string: *Intern(s) == s always holds.
It is safe for multiple goroutines to call Intern concurrently.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
packge bgzf provides readers and writers for BGZF files.
|
packge bgzf provides readers and writers for BGZF files. |
Package nibbles is a library for representing sequences of 4-bit values.
|
Package nibbles is a library for representing sequences of 4-bit values. |