-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmask.go
51 lines (40 loc) · 1.27 KB
/
mask.go
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) 2018 Ross Merrigan
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
package graphblas
// Mask is used to control how computed values are stored in the output from a method
type MaskLogical interface {
// Columns the number of columns of the mask
Columns() int
// Rows the number of rows of the mask
Rows() int
// Element of the mask for each tuple that exists in the matrix for which the value of the tuple cast to Boolean is true
//Element(r, c int) bool
}
type Mask interface {
MaskLogical
// Element of the mask for each tuple that exists in the matrix for which the value of the tuple cast to Boolean is true
Element(r, c int) bool
}
// EmptyMask is a mask with no elements but will always returns false
type EmptyMask struct {
r int
c int
}
// NewEmptyMask returns a EmptyMask
func NewEmptyMask(r, c int) *EmptyMask {
return &EmptyMask{r: r, c: c}
}
// Columns the number of columns of the mask
func (s *EmptyMask) Columns() int {
return s.c
}
// Rows the number of rows of the mask
func (s *EmptyMask) Rows() int {
return s.r
}
// Element of the mask for each tuple that exists in the matrix for which the value of the tuple cast to Boolean is true
func (s *EmptyMask) Element(r, c int) bool {
return false
}