本文整理汇总了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))
}
示例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))
}
示例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
}