memory

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory is simple ringbuffer that enables counting of concepts stored in the memory.

func New

func New(n int) *Memory

New creates a new Memory with a fixed size.

func (Memory) CountIf

func (m Memory) CountIf(p func(c *semix.Concept) bool) int

CountIf returns the number of concepts for wich the given predicate returns true.

func (Memory) CountIfS

func (m Memory) CountIfS(p func(c *semix.Concept) bool) int

CountIfS returns the number of concepts for wich the given predicate returns true. The predicate is called for each concept and referenced concept.

func (Memory) Each

func (m Memory) Each(f func(*semix.Concept))

Each calls a callback function for each concept in the memory.

func (Memory) EachS

func (m Memory) EachS(f func(*semix.Concept))

EachS calls a callback function for each concept in the memory and for each concept that is referenced from this concept.

func (Memory) Elements

func (m Memory) Elements() map[string]*semix.Concept

Elements returns the set of unique concepts in the memory.

func (Memory) ElementsS

func (m Memory) ElementsS() map[string]*semix.Concept

ElementsS returns the set of unique concepts in the memory, including all referenced concepts.

func (Memory) Len

func (m Memory) Len() int

Len returns the number of elements in the memory.

func (Memory) N

func (m Memory) N() int

N returns the maximal number of elements in the memory.

func (*Memory) Push

func (m *Memory) Push(c *semix.Concept)

Push pushes a new concept into the memory. It removes the last inserted concept.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL