/
data_record.go
54 lines (45 loc) · 1.32 KB
/
data_record.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
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @ Copyright (c) Michael Leachim @
// @ You can find additional information regarding licensing of this work in LICENSE.md @
// @ You must not remove this notice, or any other, from this software. @
// @ All rights reserved. @
// @@@@@@ At 2018-02-09 00:00<mklimoff222@gmail.com> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
package uhebom
import (
"bytes"
)
type DataRecord []*DataTree
func (r *DataRecord) display(delim string) string {
result := ""
for _, v := range *r {
result += "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
result += v.display(delim)
}
return result
}
func (r *DataRecord) convertToBase() []*DataTree {
return *r
}
func (r *DataRecord) identity() string {
var buffer bytes.Buffer
for _, v := range *r {
buffer.WriteString(v.identity())
}
return buffer.String()
}
func (r *DataRecord) size() int {
size := 0
for _, v := range *r {
size += v.treeSize()
}
return size
}
func (r *DataRecord) str() string {
var buffer bytes.Buffer
buffer.WriteString("DataRecord: ")
for _, v := range *r {
buffer.WriteString(v.elementRepresentation())
buffer.WriteString(",")
}
return buffer.String()
}