entry.go
func (e *Entry) AddEntry(child *Entry) {
	length := len(e.entries)
	if length == 0 {
		e.entries = append(e.entries, child)
		return
	}

	index := sort.Search(length, func(i int) bool {
		return child.weight > e.entries[i].weight
	})

	if index == length {
		e.entries = append(e.entries, child)
		return
	}

	e.entries = append(e.entries, nil)
	copy(e.entries[index+1:], e.entries[index:])
	e.entries[index] = child
}
func (e *Entry) AddEntry(child *Entry) {
	length := len(e.entries)
	if length == 0 {
		e.entries = append(e.entries, child)
		return
	}

	index := sort.Search(length, func(i int) bool {
		return child.weight > e.entries[i].weight
	})

	if index == length {
		e.entries = append(e.entries, child)
		return
	}

	e.entries = append(e.entries, nil)
	copy(e.entries[index+1:], e.entries[index:])
	e.entries[index] = child
}
func ( e * Entry ) AddEntry ( child * Entry ) { length := len ( e . entries ) if length == 0 { e . entries = append ( e . entries , child ) return } index := sort . Search ( length , func ( i int ) bool { return child . weight > e . entries [ i ] . weight } ) if index == length { e . entries = append ( e . entries , child ) return } e . entries = append ( e . entries , nil ) copy ( e . entries [ index + 1 : ] , e . entries [ index : ] ) e . entries [ index ] = child }
// AddEntry add new child entry. Child entries are sorted irrespective of order
// they are added. Static patterns would be indexed ahead of match patterns.
AddEntry add new child entry . Child entries are sorted irrespective of order they are added . Static patterns would be indexed ahead of match patterns .