-
Notifications
You must be signed in to change notification settings - Fork 61
/
type.go
47 lines (37 loc) · 886 Bytes
/
type.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
package tokenattributes
import (
"github.com/balzaczyy/golucene/core/util"
)
const DEFAULT_TYPE = "word"
/* A Token's lexical type. The default value is "word". */
type TypeAttribute interface {
util.Attribute
// Set the lexical type.
SetType(string)
}
/* Default implementation of TypeAttribute */
type TypeAttributeImpl struct {
typ string
}
func newTypeAttributeImpl() util.AttributeImpl {
return &TypeAttributeImpl{
typ: DEFAULT_TYPE,
}
}
func (a *TypeAttributeImpl) Interfaces() []string {
return []string{"TypeAttribute"}
}
func (a *TypeAttributeImpl) SetType(typ string) {
a.typ = typ
}
func (a *TypeAttributeImpl) Clear() {
a.typ = DEFAULT_TYPE
}
func (a *TypeAttributeImpl) Clone() util.AttributeImpl {
return &TypeAttributeImpl{
typ: a.typ,
}
}
func (a *TypeAttributeImpl) CopyTo(target util.AttributeImpl) {
target.(TypeAttribute).SetType(a.typ)
}