forked from rai-project/dlframework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
featurecomparemethod_enumer.go
69 lines (56 loc) · 2.16 KB
/
featurecomparemethod_enumer.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Code generated by "enumer -type=FeatureCompareMethod -json"; DO NOT EDIT.
//
package dlframework
import (
"encoding/json"
"fmt"
)
const _FeatureCompareMethodName = "FeatureCompuareAutomaticFeatureCompareTextEditDistanceFeatureCompareBoundingBoxIOU"
var _FeatureCompareMethodIndex = [...]uint8{0, 24, 54, 82}
func (i FeatureCompareMethod) String() string {
if i < 0 || i >= FeatureCompareMethod(len(_FeatureCompareMethodIndex)-1) {
return fmt.Sprintf("FeatureCompareMethod(%d)", i)
}
return _FeatureCompareMethodName[_FeatureCompareMethodIndex[i]:_FeatureCompareMethodIndex[i+1]]
}
var _FeatureCompareMethodValues = []FeatureCompareMethod{0, 1, 2}
var _FeatureCompareMethodNameToValueMap = map[string]FeatureCompareMethod{
_FeatureCompareMethodName[0:24]: 0,
_FeatureCompareMethodName[24:54]: 1,
_FeatureCompareMethodName[54:82]: 2,
}
// FeatureCompareMethodString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func FeatureCompareMethodString(s string) (FeatureCompareMethod, error) {
if val, ok := _FeatureCompareMethodNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to FeatureCompareMethod values", s)
}
// FeatureCompareMethodValues returns all values of the enum
func FeatureCompareMethodValues() []FeatureCompareMethod {
return _FeatureCompareMethodValues
}
// IsAFeatureCompareMethod returns "true" if the value is listed in the enum definition. "false" otherwise
func (i FeatureCompareMethod) IsAFeatureCompareMethod() bool {
for _, v := range _FeatureCompareMethodValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for FeatureCompareMethod
func (i FeatureCompareMethod) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for FeatureCompareMethod
func (i *FeatureCompareMethod) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("FeatureCompareMethod should be a string, got %s", data)
}
var err error
*i, err = FeatureCompareMethodString(s)
return err
}