當前位置: 首頁>>代碼示例>>Golang>>正文


Golang graph.NextLogOut函數代碼示例

本文整理匯總了Golang中github.com/cayleygraph/cayley/graph.NextLogOut函數的典型用法代碼示例。如果您正苦於以下問題:Golang NextLogOut函數的具體用法?Golang NextLogOut怎麽用?Golang NextLogOut使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NextLogOut函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Next

// Next advances the Or graph.iterator. Because the Or is the union of its
// subiterators, it must produce from all subiterators -- unless it it
// shortcircuiting, in which case, it is the first one that returns anything.
func (it *Or) Next() bool {
	graph.NextLogIn(it)
	var first bool
	for {
		if it.currentIterator == -1 {
			it.currentIterator = 0
			first = true
		}
		curIt := it.internalIterators[it.currentIterator]

		if graph.Next(curIt) {
			it.result = curIt.Result()
			return graph.NextLogOut(it, it.result, true)
		}

		it.err = curIt.Err()
		if it.err != nil {
			return graph.NextLogOut(it, nil, false)
		}

		if it.isShortCircuiting && !first {
			break
		}
		it.currentIterator++
		if it.currentIterator == it.itCount {
			break
		}
	}

	return graph.NextLogOut(it, nil, false)
}
開發者ID:RamboWANG,項目名稱:cayley,代碼行數:34,代碼來源:or_iterator.go

示例2: Next

// Next()ing a LinksTo operates as described above.
func (it *LinksTo) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1
	if it.nextIt.Next() {
		it.runstats.ContainsNext += 1
		it.result = it.nextIt.Result()
		return graph.NextLogOut(it, true)
	}

	// If there's an error in the 'next' iterator, we save it and we're done.
	it.err = it.nextIt.Err()
	if it.err != nil {
		return false
	}

	// Subiterator is empty, get another one
	if !it.primaryIt.Next() {
		// Possibly save error
		it.err = it.primaryIt.Err()

		// We're out of nodes in our subiterator, so we're done as well.
		return graph.NextLogOut(it, false)
	}
	it.nextIt.Close()
	it.nextIt = it.qs.QuadIterator(it.dir, it.primaryIt.Result())

	// Recurse -- return the first in the next set.
	return it.Next()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:30,代碼來源:linksto.go

示例3: Next

// Next advances the iterator.
func (it *Fixed) Next() bool {
	graph.NextLogIn(it)
	if it.lastIndex == len(it.values) {
		return graph.NextLogOut(it, nil, false)
	}
	out := it.values[it.lastIndex]
	it.result = out
	it.lastIndex++
	return graph.NextLogOut(it, out, true)
}
開發者ID:RamboWANG,項目名稱:cayley,代碼行數:11,代碼來源:fixed_iterator.go

示例4: Next

// Next advances the Skip iterator. It will skip all initial values
// before returning actual result.
func (it *Skip) Next() bool {
	graph.NextLogIn(it)
	for ; it.skipped < it.skip; it.skipped++ {
		if !it.primaryIt.Next() {
			return graph.NextLogOut(it, false)
		}
	}
	if it.primaryIt.Next() {
		return graph.NextLogOut(it, true)
	}
	return graph.NextLogOut(it, false)
}
開發者ID:rlugojr,項目名稱:cayley,代碼行數:14,代碼來源:skip_iterator.go

示例5: Next

// Next advances the Limit iterator. It will stop iteration if limit was reached.
func (it *Limit) Next() bool {
	graph.NextLogIn(it)
	if it.limit > 0 && it.count >= it.limit {
		return graph.NextLogOut(it, nil, false)
	}
	if graph.Next(it.primaryIt) {
		curr := it.primaryIt.Result()
		it.count++
		return graph.NextLogOut(it, curr, true)
	}
	return graph.NextLogOut(it, nil, false)
}
開發者ID:kortschak,項目名稱:cayley,代碼行數:13,代碼來源:limit_iterator.go

示例6: Next

// Next advances the Skip iterator. It will skip all initial values
// before returning actual result.
func (it *Skip) Next() bool {
	graph.NextLogIn(it)
	for ; it.skipped < it.skip; it.skipped++ {
		if !graph.Next(it.primaryIt) {
			return graph.NextLogOut(it, nil, false)
		}
	}
	if graph.Next(it.primaryIt) {
		curr := it.primaryIt.Result()
		return graph.NextLogOut(it, curr, true)
	}
	return graph.NextLogOut(it, nil, false)
}
開發者ID:kortschak,項目名稱:cayley,代碼行數:15,代碼來源:skip_iterator.go

示例7: Next

// Returns advances the And iterator. Because the And is the intersection of its
// subiterators, it must choose one subiterator to produce a candidate, and check
// this value against the subiterators. A productive choice of primary iterator
// is therefore very important.
func (it *And) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1
	for it.primaryIt.Next() {
		curr := it.primaryIt.Result()
		if it.subItsContain(curr, nil) {
			it.result = curr
			return graph.NextLogOut(it, true)
		}
	}
	it.err = it.primaryIt.Err()
	return graph.NextLogOut(it, false)
}
開發者ID:rlugojr,項目名稱:cayley,代碼行數:17,代碼來源:and_iterator.go

示例8: Next

// Next() on an Int64 all iterator is a simple incrementing counter.
// Return the next integer, and mark it as the result.
func (it *Int64) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1
	if it.at == -1 {
		return graph.NextLogOut(it, false)
	}
	val := it.at
	it.at = it.at + 1
	if it.at > it.max {
		it.at = -1
	}
	it.result = val
	return graph.NextLogOut(it, true)
}
開發者ID:rlugojr,項目名稱:cayley,代碼行數:16,代碼來源:all_iterator.go

示例9: Next

// Next advances the Not iterator. It returns whether there is another valid
// new value. It fetches the next value of the all iterator which is not
// contained by the primary iterator.
func (it *Not) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1

	for graph.Next(it.allIt) {
		if curr := it.allIt.Result(); !it.primaryIt.Contains(curr) {
			it.result = curr
			it.runstats.ContainsNext += 1
			return graph.NextLogOut(it, curr, true)
		}
	}
	it.err = it.allIt.Err()
	return graph.NextLogOut(it, nil, false)
}
開發者ID:RamboWANG,項目名稱:cayley,代碼行數:17,代碼來源:not_iterator.go

示例10: Next

// Next advances the iterator. This is simpler than Contains. We have a
// subiterator we can get a value from, and we can take that resultant quad,
// pull our direction out of it, and return that.
func (it *HasA) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1
	if it.resultIt != nil {
		it.resultIt.Close()
	}
	it.resultIt = &Null{}

	if !it.primaryIt.Next() {
		it.err = it.primaryIt.Err()
		return graph.NextLogOut(it, false)
	}
	tID := it.primaryIt.Result()
	val := it.qs.QuadDirection(tID, it.dir)
	it.result = val
	return graph.NextLogOut(it, true)
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:20,代碼來源:hasa.go

示例11: Next

func (it *Iterator) Next() bool {
	graph.NextLogIn(it)

	if it.iter == nil {
		return graph.NextLogOut(it, nil, false)
	}
	result, _, err := it.iter.Next()
	if err != nil {
		if err != io.EOF {
			it.err = err
		}
		return graph.NextLogOut(it, nil, false)
	}
	if !it.checkValid(result) {
		return it.Next()
	}
	it.result = result
	return graph.NextLogOut(it, it.result, true)
}
開發者ID:RamboWANG,項目名稱:cayley,代碼行數:19,代碼來源:iterator.go

示例12: Next

func (it *LinksTo) Next() bool {
	var result struct {
		ID      string  `bson:"_id"`
		Added   []int64 `bson:"Added"`
		Deleted []int64 `bson:"Deleted"`
	}
	graph.NextLogIn(it)
next:
	for {
		it.runstats.Next += 1
		if it.nextIt != nil && it.nextIt.Next(&result) {
			it.runstats.ContainsNext += 1
			if it.collection == "quads" && len(result.Added) <= len(result.Deleted) {
				continue next
			}
			it.result = QuadHash(result.ID)
			return graph.NextLogOut(it, true)
		}

		if it.nextIt != nil {
			// If there's an error in the 'next' iterator, we save it and we're done.
			it.err = it.nextIt.Err()
			if it.err != nil {
				return false
			}

		}
		// Subiterator is empty, get another one
		if !it.primaryIt.Next() {
			// Possibly save error
			it.err = it.primaryIt.Err()

			// We're out of nodes in our subiterator, so we're done as well.
			return graph.NextLogOut(it, false)
		}
		if it.nextIt != nil {
			it.nextIt.Close()
		}
		it.nextIt = it.buildIteratorFor(it.dir, it.primaryIt.Result())

		// Recurse -- return the first in the next set.
	}
}
開發者ID:rlugojr,項目名稱:cayley,代碼行數:43,代碼來源:indexed_linksto.go

示例13: Next

// Next advances the subiterator, continuing until it returns a value which it
// has not previously seen.
func (it *Unique) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1

	for it.subIt.Next() {
		curr := it.subIt.Result()
		var key interface{} = curr
		if v, ok := curr.(graph.Keyer); ok {
			key = v.Key()
		}
		if ok := it.seen[key]; !ok {
			it.result = curr
			it.seen[key] = true
			return graph.NextLogOut(it, true)
		}
	}
	it.err = it.subIt.Err()
	return graph.NextLogOut(it, false)
}
開發者ID:rlugojr,項目名稱:cayley,代碼行數:21,代碼來源:unique_iterator.go

示例14: Next

// Next advances the subiterator, continuing until it returns a value which it
// has not previously seen.
func (it *Unique) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1

	for graph.Next(it.subIt) {
		curr := it.subIt.Result()
		key := curr
		if v, ok := curr.(interface {
			Key() interface{}
		}); ok {
			key = graph.Value(v.Key())
		}
		if ok := it.seen[key]; !ok {
			it.result = curr
			it.seen[key] = true
			return graph.NextLogOut(it, it.result, true)
		}
	}
	it.err = it.subIt.Err()
	return graph.NextLogOut(it, nil, false)
}
開發者ID:kortschak,項目名稱:cayley,代碼行數:23,代碼來源:unique_iterator.go

示例15: Next

func (it *Materialize) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1
	if !it.hasRun {
		it.materializeSet()
	}
	if it.err != nil {
		return false
	}
	if it.aborted {
		n := graph.Next(it.subIt)
		it.err = it.subIt.Err()
		return n
	}

	it.index++
	it.subindex = 0
	if it.index >= len(it.values) {
		return graph.NextLogOut(it, nil, false)
	}
	return graph.NextLogOut(it, it.Result(), true)
}
開發者ID:RamboWANG,項目名稱:cayley,代碼行數:22,代碼來源:materialize_iterator.go


注:本文中的github.com/cayleygraph/cayley/graph.NextLogOut函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。