diff --git a/actr/model.go b/actr/model.go index d8b7086..8cc5b71 100644 --- a/actr/model.go +++ b/actr/model.go @@ -257,7 +257,19 @@ func (model Model) LookupModule(moduleName string) modules.Interface { return nil } -// BufferNames returns a slice of valid buffers. +// Buffers returns a slice of all valid buffers. +func (model Model) Buffers() (list buffer.List) { + for _, module := range model.Modules { + buffers := module.Buffers() + if len(buffers) > 0 { + list = append(list, buffers...) + } + } + + return +} + +// BufferNames returns a slice of valid buffer names. func (model Model) BufferNames() (list []string) { for _, module := range model.Modules { names := module.Buffers().Names() diff --git a/amod/validate.go b/amod/validate.go index a11e3a6..58cd780 100644 --- a/amod/validate.go +++ b/amod/validate.go @@ -123,12 +123,12 @@ func validateModuleInitialization(model *actr.Model, log *issueLog, init *module func validateInterModuleInitDependencies(model *actr.Model, log *issueLog, config *moduleConfig) (err error) { // when max_spread_strength is not set on memory, check for spreading_activation set on any buffer if model.Memory.MaxSpreadStrength == nil { - bufferNames := model.BufferNames() - - for _, name := range bufferNames { - buffer := model.LookupBuffer(name) + for _, buffer := range model.Buffers() { if buffer.SpreadingActivation() != buffer.DefaultSpreadingActivation() { - log.errorTR(config.Tokens, 0, 1, "spreading_activation set on buffer %q, but max_spread_strength not set on memory module", name) + log.errorTR(config.Tokens, 0, 1, + "spreading_activation set on buffer %q, but max_spread_strength not set on memory module", + buffer.Name(), + ) err = ErrCompile } }