Files
obitools4/pkg/obitax/issuubcladeof.go

23 lines
356 B
Go
Raw Normal View History

2022-01-13 23:27:39 +01:00
package obitax
2024-11-08 09:48:16 +01:00
import "log"
2022-01-13 23:27:39 +01:00
2024-11-08 09:48:16 +01:00
func (taxon *Taxon) IsSubCladeOf(parent *Taxon) bool {
2022-01-13 23:27:39 +01:00
2024-11-08 09:48:16 +01:00
if taxon.Taxonomy != parent.Taxonomy {
log.Fatalf(
"Both taxa %s and %s must belong to the same taxonomy",
taxon.String(),
parent.String(),
)
}
2022-01-13 23:27:39 +01:00
2024-11-08 09:48:16 +01:00
for t := range taxon.IPath() {
if t.Node.Id() == parent.Node.Id() {
return true
}
2022-01-13 23:27:39 +01:00
}
2024-11-08 09:48:16 +01:00
return false
2022-01-13 23:27:39 +01:00
}