feature

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExistsError       = xrr.Xrror("A %s named %s already exists.").Out
	DoesNotExistError = xrr.Xrror("A %s named %s does not exist.").Out
	NotFoundError     = xrr.Xrror("%s named %s not found").Out
)
View Source
var EmitTypeError = xrr.Xrror("unable to emit item as %s").Out
View Source
var NoConstructorError = xrr.Xrror("Constructor with tag %s does not exist.").Out

Functions

func DeqComponent

func DeqComponent(e CEnv, rcs []*RawComponent) error

func DeqEntity

func DeqEntity(e CEnv, res []*RawEntity) error

func NewData

func NewData(n float64) *data.Vector

func NewRaw

func NewRaw(e CEnv) *raw

func SetConstructor

func SetConstructor(cns ...Constructor) error

Types

type CEnv

type CEnv interface {
	Raw
	Constructors
	Features
	Components
	Entities
	Apply([]string, *data.Vector, ...MapFn) error
}

type Component

type Component interface {
	Tagger
	Defines() []string
	Features() []string
}

type Components

type Components interface {
	SetRawComponent(...*RawComponent) error
	SetComponent(...Component) error
	GetComponent(float64, string, ...string) []*data.Vector
	MustGetComponent(float64, string, ...string) []*data.Vector
	ListComponents() []Component
}

func NewComponents

func NewComponents(e CEnv) Components

type Constructor

type Constructor interface {
	Tagger
	Order() int
	Construct(string, *RawFeature, CEnv) Feature
}

func DefaultConstructor

func DefaultConstructor(tag string, fn ConstructorFn) Constructor

func GetConstructor

func GetConstructor(key string) (Constructor, bool)

func ListConstructors

func ListConstructors() []Constructor

func NewConstructor

func NewConstructor(tag string, order int, fn ConstructorFn) Constructor

type ConstructorFn

type ConstructorFn func(string, *RawFeature, CEnv) (Informer, Emitter, Mapper)

type Constructors

type Constructors interface {
	SetConstructor(...Constructor) error
	GetConstructor(string) (Constructor, bool)
	ListConstructors() []Constructor
}
var Internal Constructors

func NewConstructors

func NewConstructors() Constructors

type Detailer

type Detailer interface {
	Grouper
	Tagger
	Parenter
}

type EmitFn

type EmitFn func() data.Item

type Emitter

type Emitter interface {
	Emit() data.Item
	EmitString() (data.StringItem, error)
	EmitStrings() (data.StringsItem, error)
	EmitBool() (data.BoolItem, error)
	EmitInt() (data.IntItem, error)
	EmitFloat() (data.Float64Item, error)
	EmitVector() (data.VectorItem, error)
}

func NewEmitter

func NewEmitter(efn EmitFn) Emitter

type Entities

type Entities interface {
	SetRawEntity(...*RawEntity) error
	SetEntity(...Entity) error
	GetEntity(float64, string) []*data.Vector
	MustGetEntity(float64, string) []*data.Vector
	ListEntities() []Entity
}

func NewEntities

func NewEntities(e CEnv) Entities

type Entity

type Entity interface {
	Tagger
	Defines() []string
	Components() []string
}

type Feature

type Feature interface {
	Informer
	Emitter
	Mapper
}

func NewFeature

func NewFeature(i Informer, e Emitter, m Mapper) Feature

type FeatureGroup

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

func DecodeFeatureGroup

func DecodeFeatureGroup(s string) (*FeatureGroup, error)

func (*FeatureGroup) Bytes

func (fg *FeatureGroup) Bytes() ([]byte, error)

func (*FeatureGroup) Compress

func (fg *FeatureGroup) Compress() *bytes.Buffer

func (*FeatureGroup) List

func (fg *FeatureGroup) List() []RawFeature

func (*FeatureGroup) Value

func (fg *FeatureGroup) Value() string

type Features

type Features interface {
	AddFeature(...Feature)
	SetFeature(*RawFeature) error
	GetFeature(string) Feature
	MustGetFeature(string) Feature
	GetGroup(string) *FeatureGroup
	List(string) []RawFeature
	Remove(...string) error
}

func NewFeatures

func NewFeatures(e CEnv) Features

type Grouper

type Grouper interface {
	Group() []string
	IsGroup(string) bool
}

type Informer

type Informer interface {
	Detailer
	Valuer
	Transmitter
}

func NewInformer

func NewInformer(f string, g []string, t string, r []string, v []string) Informer

type MapFn

type MapFn func(*data.Vector)

type Mapper

type Mapper interface {
	Map(*data.Vector)
}

func NewMapper

func NewMapper(mfn MapFn) Mapper

type Parenter

type Parenter interface {
	From() string
}

type Raw

type Raw interface {
	Queue([]byte) error
	Dequeue(...string)
	//DeqComponent([]*RawComponent) error
	//DeqEntity([]*RawEntity) error
	AddRaw(...*RawFeature) error
}

type RawComponent

type RawComponent struct {
	Tag      string
	Defines  []*RawFeature
	Features []*RawFeature
}

type RawEntity

type RawEntity struct {
	Tag        string
	Defines    []*RawFeature
	Components []*RawComponent
}

type RawFeature

type RawFeature struct {
	Group       []string
	Tag         string
	Apply       string
	Values      []string
	Constructor Constructor
}

func (*RawFeature) MustGetValues

func (r *RawFeature) MustGetValues() []string

type Tagger

type Tagger interface {
	Tag() string
}

type Transmitter

type Transmitter interface {
	RawFeature() RawFeature
}

type Valuer

type Valuer interface {
	Raw() string
	Values() []string
	Length() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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