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


Golang SkipList.Get方法代碼示例

本文整理匯總了Golang中github.com/Workiva/go-datastructures/slice/skip.SkipList.Get方法的典型用法代碼示例。如果您正苦於以下問題:Golang SkipList.Get方法的具體用法?Golang SkipList.Get怎麽用?Golang SkipList.Get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/Workiva/go-datastructures/slice/skip.SkipList的用法示例。


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

示例1: deleteRecursive

// deleteRecursive is used by the delete logic.  The recursion depth
// only goes as far as the number of dimensions, so this shouldn't be an
// issue.
func (rt *skipListRT) deleteRecursive(sl *skip.SkipList, dimension uint64,
	entry rangetree.Entry) rangetree.Entry {

	value := entry.ValueAtDimension(dimension)
	if isLastDimension(dimension, rt.dimensions) {
		entries := sl.Delete(skipEntry(value))
		if entries[0] == nil {
			return nil
		}

		rt.number--
		return entries[0].(*lastBundle).entry
	}

	db, ok := sl.Get(skipEntry(value))[0].(*dimensionalBundle)
	if !ok { // value was not found
		return nil
	}

	result := rt.deleteRecursive(db.sl, dimension+1, entry)
	if result == nil {
		return nil
	}

	if db.sl.Len() == 0 {
		sl.Delete(db)
	}

	return result
}
開發者ID:amareshp,項目名稱:go-datastructures,代碼行數:33,代碼來源:skiplist.go


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