File: util.go

package info (click to toggle)
golang-github-shenwei356-bwt 0.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 100 kB
  • sloc: makefile: 2
file content (32 lines) | stat: -rw-r--r-- 506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package fmi

type sMatch struct {
	query      []byte
	start, end int
	mismatches int
}

// Stack struct
type Stack []sMatch

// Empty tell if it is empty
func (s Stack) Empty() bool {
	return len(s) == 0
}

// Peek return the last element
func (s Stack) Peek() sMatch {
	return s[len(s)-1]
}

// Put puts element to stack
func (s *Stack) Put(i sMatch) {
	(*s) = append((*s), i)
}

// Pop pops element from the stack
func (s *Stack) Pop() sMatch {
	d := (*s)[len(*s)-1]
	(*s) = (*s)[:len(*s)-1]
	return d
}