Skip to content
Snippets Groups Projects
hierarchyStruct.go 537 B
package entity

type PdictList []Pdict

type Pdict struct {
	Typename string
	Pointer  int
}

type Triple struct {
	In  int
	Rel int
	Out int
}

type Tree struct {
	Self     Triple
	Parent   int
	Children []int
}

func (p PdictList) Len() int {
	return len(p)
}

func (p PdictList) Less(i, j int) bool {
	if p[i].Typename < p[j].Typename {
		return true
	} else if p[i].Typename == p[j].Typename && p[i].Pointer < p[j].Pointer {
		return true
	} else {
		return false
	}
}

func (p PdictList) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}