Exemplo n.º 1
0
func SettingLine(l term.SettingLine) term.T {
	switch l := l.(type) {
	case term.TemplateID:
		return Template(l)
	case term.ActionCID:
		return ActionC(l.ActionC())
	default:
		panic("quoting unknown type of setting line!")
	}
}
Exemplo n.º 2
0
func match(a, b term.SettingLine) (float32, bool) {
	if a.Slots() != b.Slots() {
		return 0.0, false
	}
	switch a := a.(type) {
	case term.ActionCID:
		switch b := b.(type) {
		case term.ActionCID:
			return 1 - distance(a.String(), b.String()), true
		default:
			return 0.0, false
		}
	case term.TemplateID:
		switch b := b.(type) {
		case term.TemplateID:
			return 1 - distance(a.String(), b.String()), true
		default:
			return 0.0, false
		}
	default:
		return 0.0, false
	}
}