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


Golang Dwimmer.Get方法代碼示例

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


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

示例1: getTransition

func getTransition(d dynamics.Dwimmer, s *term.SettingT, quotedSetting term.T) term.T {
	setting, err := represent.ToSetting(d, quotedSetting)
	if err != nil {
		return term.Make("asked to get a transition in setting [], "+
			"but while converting to a setting received []").T(quotedSetting, err)
	}
	result, ok := d.Get(setting)
	if !ok {
		return NoCompiledAction.T()
	}
	return core.Answer.T(represent.Transition(result))
}
開發者ID:paulfchristiano,項目名稱:dwimmer,代碼行數:12,代碼來源:elicit.go

示例2: findAction

func findAction(d dynamics.Dwimmer, s *term.SettingT, quotedSetting term.T) term.T {
	setting, err := represent.ToSetting(d, quotedSetting)
	if err != nil {
		return term.Make("asked to decide what to do in setting [], "+
			"but while converting to a setting received []").T(quotedSetting, err)
	}
	transition, ok := d.Get(setting)
	if !ok {
		transition := ElicitAction(d, s, setting)
		d.Save(setting, transition)
	}
	return core.Answer.T(represent.Transition(transition))
}
開發者ID:paulfchristiano,項目名稱:dwimmer,代碼行數:13,代碼來源:elicit.go

示例3: Suggestions

func Suggestions(d dynamics.Dwimmer, s *term.Setting, n int) ([]term.ActionC, []float32) {
	settings, settingPriorities := analogies(d, s, n)
	result := []term.ActionC{}
	priorities := []float32{}
buildingResult:
	for i, other := range settings {
		t, _ := d.Get(other)
		simple, isSimple := t.(dynamics.SimpleTransition)
		if isSimple {
			action := simple.Action
			for _, otherAction := range result {
				if action.ID() == otherAction.ID() {
					continue buildingResult
				}
			}
			result = append(result, action)
			priorities = append(priorities, settingPriorities[i])
		}
	}
	return result, priorities
}
開發者ID:paulfchristiano,項目名稱:dwimmer,代碼行數:21,代碼來源:similarity.go


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