Esempio n. 1
0
func (n *EmbListNode) SaveUnsupportedExts(orgLen int, vord []int, eps *set.SortedSet) error {
	if n.Dt.Config.Mode&ExtensionPruning == 0 {
		return nil
	}
	n.unsupExts = set.NewSortedSet(eps.Size())
	for x, next := eps.Items()(); next != nil; x, next = next() {
		ep := x.(*subgraph.Extension)
		ept := ep.Translate(orgLen, vord)
		n.unsupExts.Add(ept)
	}
	if n.Dt.UnsupExts == nil || n.Dt.Config.Mode&Caching == 0 {
		return nil
	}
	n.Dt.lock.Lock()
	defer n.Dt.lock.Unlock()
	if len(n.Pat.E) < 4 {
		return nil
	}
	label := n.Label()
	for x, next := n.unsupExts.Items()(); next != nil; x, next = next() {
		ept := x.(*subgraph.Extension)
		err := n.Dt.UnsupExts.Add(label, ept)
		if err != nil {
			return err
		}
	}
	return nil
}
Esempio n. 2
0
File: node.go Progetto: timtadh/sfp
func setToInt32s(s *set.SortedSet) []int32 {
	items := make([]int32, 0, s.Size())
	for i, n := s.Items()(); n != nil; i, n = n() {
		item := int32(i.(types.Int32))
		items = append(items, item)
	}
	return items
}