• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang graph.NextLogOut函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/google/cayley/graph.NextLogOut函数的典型用法代码示例。如果您正苦于以下问题:Golang NextLogOut函数的具体用法?Golang NextLogOut怎么用?Golang NextLogOut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NextLogOut函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
		}

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

	return graph.NextLogOut(it, nil, false)
}
开发者ID:ericcapricorn,项目名称:cayley,代码行数:29,代码来源:or_iterator.go


示例2: Next

// Returns the Next value from the Or graph.iterator. Because the Or is the
// union of its subiterators, it must produce from all subiterators -- unless
// it's shortcircuiting, in which case, it's the first one that returns anything.
func (it *Or) Next() (graph.Value, bool) {
	graph.NextLogIn(it)
	var curr graph.Value
	var exists bool
	firstTime := false
	for {
		if it.currentIterator == -1 {
			it.currentIterator = 0
			firstTime = true
		}
		curIt := it.internalIterators[it.currentIterator]
		curr, exists = graph.Next(curIt)
		if !exists {
			if it.isShortCircuiting && !firstTime {
				return graph.NextLogOut(it, nil, false)
			}
			it.currentIterator++
			if it.currentIterator == it.itCount {
				return graph.NextLogOut(it, nil, false)
			}
		} else {
			it.result = curr
			return graph.NextLogOut(it, curr, true)
		}
	}
	panic("unreachable")
}
开发者ID:neevor,项目名称:cayley,代码行数:30,代码来源:or_iterator.go


示例3: Next

// Returns the Next value from the Or graph.iterator. Because the Or is the
// union of its subiterators, it must produce from all subiterators -- unless
// it's shortcircuiting, in which case, it's the first one that returns anything.
func (it *Or) Next() (graph.TSVal, bool) {
	graph.NextLogIn(it)
	var curr graph.TSVal
	var exists bool
	firstTime := false
	for {
		if it.currentIterator == -1 {
			it.currentIterator = 0
			firstTime = true
		}
		curIt := it.internalIterators[it.currentIterator]
		curr, exists = curIt.Next()
		if !exists {
			if it.isShortCircuiting && !firstTime {
				return graph.NextLogOut(it, nil, false)
			}
			it.currentIterator++
			if it.currentIterator == it.itCount {
				return graph.NextLogOut(it, nil, false)
			}
		} else {
			it.Last = curr
			return graph.NextLogOut(it, curr, true)
		}
	}
	panic("Somehow broke out of Next() loop in Or")
}
开发者ID:heshizhu,项目名称:cayley,代码行数:30,代码来源:or_iterator.go


示例4: Next

// Next()ing a LinksTo operates as described above.
func (it *LinksTo) Next() bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1
	if graph.Next(it.nextIt) {
		it.runstats.ContainsNext += 1
		it.result = it.nextIt.Result()
		return graph.NextLogOut(it, it.result, 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 !graph.Next(it.primaryIt) {
		// 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, nil, 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:dennwc,项目名称:cayley,代码行数:30,代码来源:linksto_iterator.go


示例5: Next

func (it *Iterator) Next() (graph.TSVal, bool) {
	graph.NextLogIn(it)
	if it.tree.Max() == nil || it.Last == int64(it.tree.Max().(Int64)) {
		return graph.NextLogOut(it, nil, false)
	}
	it.iterLast = IterateOne(it.tree, it.iterLast)
	it.Last = int64(it.iterLast)
	return graph.NextLogOut(it, it.Last, true)
}
开发者ID:jandersen,项目名称:cayley,代码行数:9,代码来源:iterator.go


示例6: 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:ericcapricorn,项目名称:cayley,代码行数:11,代码来源:fixed_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 graph.Next(it.primaryIt) {
		curr := it.primaryIt.Result()
		if it.subItsContain(curr, nil) {
			it.result = curr
			return graph.NextLogOut(it, curr, true)
		}
	}
	return graph.NextLogOut(it, nil, false)
}
开发者ID:Joeento,项目名称:cayley,代码行数:16,代码来源: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)
	if it.at == -1 {
		return graph.NextLogOut(it, nil, false)
	}
	val := it.at
	it.at = it.at + 1
	if it.at > it.max {
		it.at = -1
	}
	it.result = val
	return graph.NextLogOut(it, val, true)
}
开发者ID:jacqui,项目名称:cayley,代码行数:15,代码来源:all_iterator.go


示例9: 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() (graph.Value, bool) {
	graph.NextLogIn(it)
	if it.at == -1 {
		return graph.NextLogOut(it, nil, false)
	}
	val := it.at
	it.at = it.at + 1
	if it.at > it.max {
		it.at = -1
	}
	it.Last = val
	return graph.NextLogOut(it, val, true)
}
开发者ID:ZSIT,项目名称:cayley,代码行数:15,代码来源:all_iterator.go


示例10: 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:oliverp19,项目名称:cayley,代码行数:17,代码来源:not_iterator.go


示例11: Next

// Returns the Next value from 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() (graph.TSVal, bool) {
	graph.NextLogIn(it)
	var curr graph.TSVal
	var exists bool
	for {
		curr, exists = it.primaryIt.Next()
		if !exists {
			return graph.NextLogOut(it, nil, false)
		}
		if it.checkSubIts(curr) {
			it.Last = curr
			return graph.NextLogOut(it, curr, true)
		}
	}
	panic("Somehow broke out of Next() loop in And")
}
开发者ID:heshizhu,项目名称:cayley,代码行数:20,代码来源:and_iterator.go


示例12: 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 !graph.Next(it.primaryIt) {
		return graph.NextLogOut(it, 0, false)
	}
	tID := it.primaryIt.Result()
	val := it.qs.QuadDirection(tID, it.dir)
	it.result = val
	return graph.NextLogOut(it, val, true)
}
开发者ID:ericcapricorn,项目名称:cayley,代码行数:19,代码来源:hasa_iterator.go


示例13: 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 {
		return graph.NextLogOut(it, nil, false)
	}
	if !it.checkValid(result) {
		return it.Next()
	}
	it.result = result
	return graph.NextLogOut(it, it.result, true)
}
开发者ID:Joeento,项目名称:cayley,代码行数:16,代码来源:iterator.go


示例14: Next

func (it *Materialize) Next() bool {
	graph.NextLogIn(it)
	if !it.hasRun {
		it.materializeSet()
	}
	if it.aborted {
		return graph.Next(it.subIt)
	}

	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:jacqui,项目名称:cayley,代码行数:16,代码来源:materialize_iterator.go


示例15: Next

// Returns the Next value from 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() (graph.Value, bool) {
	graph.NextLogIn(it)
	var curr graph.Value
	var exists bool
	for {
		curr, exists = graph.Next(it.primaryIt)
		if !exists {
			return graph.NextLogOut(it, nil, false)
		}
		if it.subItsContain(curr) {
			it.result = curr
			return graph.NextLogOut(it, curr, true)
		}
	}
	panic("unreachable")
}
开发者ID:neevor,项目名称:cayley,代码行数:20,代码来源:and_iterator.go


示例16: Next

// Get the next result from this iterator. This is simpler than Check. We have a
// subiterator we can get a value from, and we can take that resultant triple,
// pull our direction out of it, and return that.
func (it *HasA) Next() (graph.TSVal, bool) {
	graph.NextLogIn(it)
	if it.resultIt != nil {
		it.resultIt.Close()
	}
	it.resultIt = &Null{}

	tID, ok := it.primaryIt.Next()
	if !ok {
		return graph.NextLogOut(it, 0, false)
	}
	name := it.ts.GetTriple(tID).Get(it.dir)
	val := it.ts.GetIdFor(name)
	it.Last = val
	return graph.NextLogOut(it, val, true)
}
开发者ID:heshizhu,项目名称:cayley,代码行数:19,代码来源:hasa_iterator.go


示例17: Next

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

	tID, ok := graph.Next(it.primaryIt)
	if !ok {
		return graph.NextLogOut(it, 0, false)
	}
	name := it.ts.Quad(tID).Get(it.dir)
	val := it.ts.ValueOf(name)
	it.result = val
	return graph.NextLogOut(it, val, true)
}
开发者ID:neevor,项目名称:cayley,代码行数:19,代码来源:hasa_iterator.go


示例18: 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 triple,
// pull our direction out of it, and return that.
func (it *HasA) Next() bool {
	graph.NextLogIn(it)
	if it.resultIt != nil {
		it.resultIt.Close()
	}
	it.resultIt = &Null{}

	if !graph.Next(it.primaryIt) {
		return graph.NextLogOut(it, 0, false)
	}
	tID := it.primaryIt.Result()
	name := it.ts.Quad(tID).Get(it.dir)
	val := it.ts.ValueOf(name)
	it.result = val
	return graph.NextLogOut(it, val, true)
}
开发者ID:uriencedric,项目名称:cayley,代码行数:19,代码来源:hasa_iterator.go


示例19: Next

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

	// Subiterator is empty, get another one
	if !graph.Next(it.primaryIt) {
		// We're out of nodes in our subiterator, so we're done as well.
		return graph.NextLogOut(it, 0, false)
	}
	it.nextIt.Close()
	it.nextIt = it.ts.TripleIterator(it.dir, it.primaryIt.Result())

	// Recurse -- return the first in the next set.
	return it.Next()
}
开发者ID:jacqui,项目名称:cayley,代码行数:19,代码来源:linksto_iterator.go


示例20: Next

// Next()ing a LinksTo operates as described above.
func (it *LinksTo) Next() (graph.Value, bool) {
	graph.NextLogIn(it)
	val, ok := graph.Next(it.nextIt)
	if !ok {
		// Subiterator is empty, get another one
		candidate, ok := graph.Next(it.primaryIt)
		if !ok {
			// We're out of nodes in our subiterator, so we're done as well.
			return graph.NextLogOut(it, 0, false)
		}
		it.nextIt.Close()
		it.nextIt = it.ts.TripleIterator(it.dir, candidate)
		// Recurse -- return the first in the next set.
		return it.Next()
	}
	it.result = val
	return graph.NextLogOut(it, val, ok)
}
开发者ID:neevor,项目名称:cayley,代码行数:19,代码来源:linksto_iterator.go



注:本文中的github.com/google/cayley/graph.NextLogOut函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang graph.RegisterIterator函数代码示例发布时间:2022-05-23
下一篇:
Golang graph.NextLogIn函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap