package modules /* Sub정보들을 관리할 list */ type NameList struct { head *NameNode tail *NameNode size int } type NameNode struct { name []int64 // Encrypt된 name next *NameNode list List } type List struct { head *Node tail *Node size int } type Node struct { val []int64 // Encrypt된 value next *Node // single // single2sub_s []int // (val < x) sub# single2sub_es []int // (val <= x) sub# single2sub_b []int // (val > x) sub# single2sub_eb []int // (val >= x) sub# single2sub_e []int // (val == x) sub# // range // range2sub_s []int // (val < x and ...) sub# range2sub_es []int // (val <= x and ...) sub# range2sub_b []int // (val > x and ...) sub# range2sub_eb []int // (val >= x and ...) sub# } // ### To delete slice Array func remove(s []int, i int) []int { return append(s[:i], s[i+1:]...) } // 노드의 operator리스트에 sub#을 in func (l *Node) insert_Sub(op string, sub int, issingle bool) { if issingle == true { switch op { case "<": l.single2sub_s = append(l.single2sub_s, sub) case "<=": l.single2sub_es = append(l.single2sub_es, sub) case ">": l.single2sub_b = append(l.single2sub_b, sub) case ">=": l.single2sub_eb = append(l.single2sub_eb, sub) case "==": l.single2sub_e = append(l.single2sub_e, sub) } } else { switch op { case "<": l.range2sub_s = append(l.range2sub_s, sub) case "<=": l.range2sub_es = append(l.range2sub_es, sub) case ">": l.range2sub_b = append(l.range2sub_b, sub) case ">=": l.range2sub_eb = append(l.range2sub_eb, sub) } } } func (l *List) add_ValueNode(val string, op string, sub int, issingle bool) { newValNode := &Node{conv(val), nil, nil, nil, nil, nil, nil, nil, nil, nil, nil} newValNode.insert_Sub(op, sub, true) l.tail.next = newValNode l.tail = newValNode l.size++ } func (l * List)getPos(value []int64) *Node{ valptr := l.head for valptr != nil{ if compare(valptr.val, value) == 1 { // value와 같은 val을 갖는 노드가 존재한다면 return valptr } } return nil }