当前位置: 首页>>代码示例>>Golang>>正文


Golang graph.ContainsLogOut函数代码示例

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


在下文中一共展示了ContainsLogOut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Contains

func (it *Iterator) Contains(v graph.Value) bool {
	graph.ContainsLogIn(it, v)
	if it.isAll {
		// The result needs to be set, so when contains is called, the result can be retrieved
		it.result = v
		return graph.ContainsLogOut(it, v, true)
	}
	t := v.(*Token)
	if t == nil {
		glog.Error("Could not cast to token")
		return graph.ContainsLogOut(it, v, false)
	}
	if t.Kind == nodeKind {
		glog.Error("Contains does not work with node values")
		return graph.ContainsLogOut(it, v, false)
	}
	// Contains is for when you want to know that an iterator refers to a quad
	var offset int
	switch it.dir {
	case quad.Subject:
		offset = 0
	case quad.Predicate:
		offset = (hashSize * 2)
	case quad.Object:
		offset = (hashSize * 2) * 2
	case quad.Label:
		offset = (hashSize * 2) * 3
	}
	val := t.Hash[offset : offset+(hashSize*2)]
	if val == it.hash {
		return graph.ContainsLogOut(it, v, true)
	}
	return graph.ContainsLogOut(it, v, false)
}
开发者ID:e4x,项目名称:cayley,代码行数:34,代码来源:iterator.go

示例2: Contains

func (it *Iterator) Contains(v graph.Value) bool {
	graph.ContainsLogIn(it, v)
	if _, ok := it.tree.Get(v.(int64)); ok {
		it.result = v
		return graph.ContainsLogOut(it, v, true)
	}
	return graph.ContainsLogOut(it, v, false)
}
开发者ID:Joeento,项目名称:cayley,代码行数:8,代码来源:iterator.go

示例3: Contains

func (it *Iterator) Contains(v graph.Value) bool {
	graph.ContainsLogIn(it, v)
	if it.tree.Has(Int64(v.(int64))) {
		it.result = v
		return graph.ContainsLogOut(it, v, true)
	}
	return graph.ContainsLogOut(it, v, false)
}
开发者ID:jacqui,项目名称:cayley,代码行数:8,代码来源:iterator.go

示例4: Contains

// Check a value against the entire graph.iterator, in order.
func (it *Or) Contains(val graph.Value) bool {
	graph.ContainsLogIn(it, val)
	anyGood := it.subItsContain(val)
	if !anyGood {
		return graph.ContainsLogOut(it, val, false)
	}
	it.result = val
	return graph.ContainsLogOut(it, val, true)
}
开发者ID:ericcapricorn,项目名称:cayley,代码行数:10,代码来源:or_iterator.go

示例5: Contains

// If it checks in the right direction for the subiterator, it is a valid link
// for the LinksTo.
func (it *LinksTo) Contains(val graph.Value) bool {
	graph.ContainsLogIn(it, val)
	node := it.ts.TripleDirection(val, it.dir)
	if it.primaryIt.Contains(node) {
		it.result = val
		return graph.ContainsLogOut(it, val, true)
	}
	return graph.ContainsLogOut(it, val, false)
}
开发者ID:neevor,项目名称:cayley,代码行数:11,代码来源:linksto_iterator.go

示例6: Contains

// Contains() for an Int64 is merely seeing if the passed value is
// withing the range, assuming the value is an int64.
func (it *Int64) Contains(tsv graph.Value) bool {
	graph.ContainsLogIn(it, tsv)
	v := tsv.(int64)
	if it.min <= v && v <= it.max {
		it.result = v
		return graph.ContainsLogOut(it, v, true)
	}
	return graph.ContainsLogOut(it, v, false)
}
开发者ID:jacqui,项目名称:cayley,代码行数:11,代码来源:all_iterator.go

示例7: Contains

// If it checks in the right direction for the subiterator, it is a valid link
// for the LinksTo.
func (it *LinksTo) Contains(val graph.Value) bool {
	graph.ContainsLogIn(it, val)
	it.runstats.Contains += 1
	node := it.qs.QuadDirection(val, it.dir)
	if it.primaryIt.Contains(node) {
		it.result = val
		return graph.ContainsLogOut(it, val, true)
	}
	return graph.ContainsLogOut(it, val, false)
}
开发者ID:EntilZha,项目名称:cayley,代码行数:12,代码来源:linksto_iterator.go

示例8: Contains

// Check a value against the entire graph.iterator, in order.
func (it *Or) Contains(val graph.Value) bool {
	graph.ContainsLogIn(it, val)
	anyGood, err := it.subItsContain(val)
	if err != nil {
		it.err = err
		return false
	} else if !anyGood {
		return graph.ContainsLogOut(it, val, false)
	}
	it.result = val
	return graph.ContainsLogOut(it, val, true)
}
开发者ID:e4x,项目名称:cayley,代码行数:13,代码来源:or_iterator.go

示例9: Contains

// Check if the passed value is equal to one of the values stored in the iterator.
func (it *Fixed) Contains(v graph.Value) bool {
	// Could be optimized by keeping it sorted or using a better datastructure.
	// However, for fixed iterators, which are by definition kind of tiny, this
	// isn't a big issue.
	graph.ContainsLogIn(it, v)
	for _, x := range it.values {
		if it.cmp(x, v) {
			it.result = x
			return graph.ContainsLogOut(it, v, true)
		}
	}
	return graph.ContainsLogOut(it, v, false)
}
开发者ID:ericcapricorn,项目名称:cayley,代码行数:14,代码来源:fixed_iterator.go

示例10: Contains

func (it *Iterator) Contains(v graph.Value) bool {
	graph.ContainsLogIn(it, v)
	if it.isAll {
		it.result = v
		return graph.ContainsLogOut(it, v, true)
	}
	val := NodeHash(v.(QuadHash).Get(it.dir))
	if val == it.hash {
		it.result = v
		return graph.ContainsLogOut(it, v, true)
	}
	return graph.ContainsLogOut(it, v, false)
}
开发者ID:dennwc,项目名称:cayley,代码行数:13,代码来源:iterator.go

示例11: Contains

// Contains() for an Int64 is merely seeing if the passed value is
// withing the range, assuming the value is an int64.
func (it *Int64) Contains(tsv graph.Value) bool {
	graph.ContainsLogIn(it, tsv)
	it.runstats.Contains += 1
	var v int64
	if tsv.IsNode() {
		v = int64(tsv.(Int64Node))
	} else {
		v = int64(tsv.(Int64Quad))
	}
	if it.min <= v && v <= it.max {
		it.result = v
		return graph.ContainsLogOut(it, it.toValue(v), true)
	}
	return graph.ContainsLogOut(it, it.toValue(v), false)
}
开发者ID:dennwc,项目名称:cayley,代码行数:17,代码来源:all_iterator.go

示例12: Contains

// Check a value against the entire iterator, in order.
func (it *And) Contains(val graph.Value) bool {
	graph.ContainsLogIn(it, val)
	if it.checkList != nil {
		return it.checkContainsList(val)
	}
	mainGood := it.primaryIt.Contains(val)
	if !mainGood {
		return graph.ContainsLogOut(it, val, false)
	}
	othersGood := it.subItsContain(val)
	if !othersGood {
		return graph.ContainsLogOut(it, val, false)
	}
	it.result = val
	return graph.ContainsLogOut(it, val, true)
}
开发者ID:neevor,项目名称:cayley,代码行数:17,代码来源:and_iterator.go

示例13: Contains

// Contains ???
// BUG(bmatsuo):
// Contains is surely broken. It just looks for v in the given database.  It
// seems like it should buffer the output, or run the iteration again.
func (it *AllIterator) Contains(v graph.Value) (ok bool) {
	graph.ContainsLogIn(it, v)
	defer func() { graph.ContainsLogOut(it, v, ok) }()

	tok, ok := v.(*Token)
	if !ok {
		return false
	}
	if tok.db != it.db {
		return false
	}

	err := it.qs.env.View(func(tx *lmdb.Txn) (err error) {
		tx.RawRead = true
		_, err = tx.Get(it.qs.dbis[tok.db], tok.key)
		ok = !lmdb.IsNotFound(err)
		return err
	})
	if err != nil {
		return false
	}
	if ok {
		it.result = tok
	}
	return ok

}
开发者ID:bmatsuo,项目名称:cayley,代码行数:31,代码来源:all_iterator.go

示例14: checkContainsList

func (it *And) checkContainsList(val graph.Value, lastResult graph.Value) bool {
	ok := true
	for i, c := range it.checkList {
		ok = c.Contains(val)
		if !ok {
			it.err = c.Err()
			if it.err != nil {
				return false
			}

			if lastResult != nil {
				for j := 0; j < i; j++ {
					// One of the iterators has determined that this value doesn't
					// match. However, the iterators that came before in the list
					// may have returned "ok" to Contains().  We need to set all
					// the tags back to what the previous result was -- effectively
					// seeking back exactly one -- so we check all the prior iterators
					// with the (already verified) result and throw away the result,
					// which will be 'true'
					it.checkList[j].Contains(lastResult)

					it.err = it.checkList[j].Err()
					if it.err != nil {
						return false
					}
				}
			}
			break
		}
	}
	if ok {
		it.result = val
	}
	return graph.ContainsLogOut(it, val, ok)
}
开发者ID:e4x,项目名称:cayley,代码行数:35,代码来源:and_iterator.go

示例15: Contains

// Contains checks whether the passed value is part of the primary iterator's
// complement. For a valid value, it updates the Result returned by the iterator
// to the value itself.
func (it *Not) Contains(val graph.Value) bool {
	graph.ContainsLogIn(it, val)
	it.runstats.Contains += 1

	if it.primaryIt.Contains(val) {
		return graph.ContainsLogOut(it, val, false)
	}

	it.err = it.primaryIt.Err()
	if it.err != nil {
		// Explicitly return 'false', since an error occurred.
		return false
	}

	it.result = val
	return graph.ContainsLogOut(it, val, true)
}
开发者ID:oliverp19,项目名称:cayley,代码行数:20,代码来源:not_iterator.go


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