Documentation ¶
Index ¶
- type Applier
- type Interlabel
- type Intertemplate
- type Intertuple
- type Label
- type LabelledTuple
- func (lt *LabelledTuple) Apply(fun func(field interface{}) interface{}) (b bool)
- func (lt LabelledTuple) Delimiter() string
- func (lt *LabelledTuple) Fields() (flds []interface{})
- func (lt *LabelledTuple) GetFieldAt(i int) (fld interface{})
- func (lt *LabelledTuple) Labels() (ls Labels)
- func (lt *LabelledTuple) Length() (sz int)
- func (lt *LabelledTuple) MatchLabels(ls Labels) (mls *Labels, b bool)
- func (lt *LabelledTuple) MatchTemplate(tp Template) (b bool)
- func (lt LabelledTuple) ParenthesisType() (string, string)
- func (lt *LabelledTuple) SetFieldAt(i int, val interface{}) (b bool)
- func (lt LabelledTuple) String() (s string)
- func (lt *LabelledTuple) Tuple() (t Tuple)
- type Labels
- func (ls *Labels) Add(l Label) (b bool)
- func (ls *Labels) Delete(id string) (b bool)
- func (ls *Labels) Intersect(lm *Labels) (li *Labels, e bool)
- func (ls *Labels) Labelling() (labelling []string)
- func (ls *Labels) Retrieve(id string) (l *Label)
- func (ls *Labels) Set() (set []Label)
- func (ls Labels) String() (s string)
- type Signature
- type Template
- func (tp *Template) Apply(fun func(field interface{}) interface{}) (b bool)
- func (tp *Template) Equal(tq *Template) (e bool)
- func (tp *Template) ExactMatch(tq *Template) (e bool, pno, qno uint)
- func (tp *Template) Fields() (flds []interface{})
- func (tp Template) GetDelimiter() string
- func (tp *Template) GetFieldAt(i int) (fld interface{})
- func (tp Template) GetParenthesisType() (string, string)
- func (tp *Template) Length() (sz int)
- func (tp *Template) Match(tq *Template) (e bool)
- func (tp *Template) NewTuple() (t Tuple)
- func (tp Template) String() string
- type Tuple
- func (t *Tuple) Apply(fun func(field interface{}) interface{}) (b bool)
- func (t *Tuple) Fields() (flds []interface{})
- func (t Tuple) GetDelimiter() string
- func (t *Tuple) GetFieldAt(i int) (fld interface{})
- func (t Tuple) GetParenthesisType() (string, string)
- func (t *Tuple) Length() (sz int)
- func (t *Tuple) Match(tp Template) (b bool)
- func (t *Tuple) SetFieldAt(i int, val interface{}) (b bool)
- func (t Tuple) String() string
- func (t *Tuple) Tuple() (tn Tuple)
- func (t *Tuple) WriteToVariables(params ...interface{}) (b bool)
- type TypeField
- type TypeRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier interface { // Applier interface iterates over values and applies function fun on each value. // Applier returns true function fun could be applied to each element, and false otherwise. Apply(fun func(interface{}) interface{}) bool }
Applier interface describes for map functionality for collections.
type Interlabel ¶
type Interlabel interface {
Id() (id string)
}
Interlabel is an internal interface for manipulating a label.
type Intertemplate ¶
type Intertemplate interface { Applier Length() int Fields() []interface{} GetFieldAt(i int) interface{} NewTuple() Tuple }
Intertemplate an interface for manipulating templates.
type Intertuple ¶
type Intertuple interface { Applier Tuple() Tuple Length() int Fields() []interface{} GetFieldAt(i int) interface{} SetFieldAt(i int, val interface{}) bool }
Intertuple defines an interface for manipulating tuples.
type Label ¶
type Label Tuple
Label is a structure used to label arbitrary data.
func (Label) Delimiter ¶
Delimiter returns the delimiter used to seperated the values in label l. Delimiter is used in the String() method.
func (*Label) Equal ¶
Equal returns true if both labels l and m are equivalent, and false otherwise.
func (Label) ParenthesisType ¶
ParenthesisType returns a pair of strings that encapsulates the tuple. ParenthesisType is used in the String() method.
type LabelledTuple ¶
type LabelledTuple Tuple
LabelledTuple is a labelled tuple containing a list of fields and a label set. Fields can be any data type and is used to store data. TupleLabels is a label set that is associated to the tuple itself.
func NewLabelledTuple ¶
func NewLabelledTuple(fields ...interface{}) (lt LabelledTuple)
NewLabelledTuple creates a labelled tuple according to the labels and values present in the fields. NewLabelledTuple searches the first field for labels.
func (*LabelledTuple) Apply ¶
func (lt *LabelledTuple) Apply(fun func(field interface{}) interface{}) (b bool)
Apply iterates through the labelled tuple t and applies the function fun to each field. Apply returns true function fun could be applied to all the fields, and false otherwise.
func (LabelledTuple) Delimiter ¶
func (lt LabelledTuple) Delimiter() string
Delimiter returns the delimiter used to seperate a labelled tuple t's fields. Delimiter is used in the String() method.
func (*LabelledTuple) Fields ¶
func (lt *LabelledTuple) Fields() (flds []interface{})
Fields returns the fields of the tuple.
func (*LabelledTuple) GetFieldAt ¶
func (lt *LabelledTuple) GetFieldAt(i int) (fld interface{})
GetFieldAt returns the i'th field of the tuple.
func (*LabelledTuple) Labels ¶
func (lt *LabelledTuple) Labels() (ls Labels)
Labels returns the label set belonging to the labelled tuple.
func (*LabelledTuple) Length ¶
func (lt *LabelledTuple) Length() (sz int)
Length returns the amount of fields of the tuple.
func (*LabelledTuple) MatchLabels ¶
func (lt *LabelledTuple) MatchLabels(ls Labels) (mls *Labels, b bool)
MatchLabels matches a labelled tuples t labels against labels ls.
func (*LabelledTuple) MatchTemplate ¶
func (lt *LabelledTuple) MatchTemplate(tp Template) (b bool)
MatchTemplate pattern matches labelled tuple t against the template tp. MatchTemplate discriminates between encapsulated formal fields and actual fields. MatchTemplate returns true if the template matches the labelled tuple and false otherwise.
func (LabelledTuple) ParenthesisType ¶
func (lt LabelledTuple) ParenthesisType() (string, string)
ParenthesisType returns a pair of strings that encapsulates labelled tuple t. ParenthesisType is used in the String() method.
func (*LabelledTuple) SetFieldAt ¶
func (lt *LabelledTuple) SetFieldAt(i int, val interface{}) (b bool)
SetFieldAt sets the i'th field of the tuple to the value of val.
func (LabelledTuple) String ¶
func (lt LabelledTuple) String() (s string)
String returns a print friendly representation of the tuple.
func (*LabelledTuple) Tuple ¶
func (lt *LabelledTuple) Tuple() (t Tuple)
Tuple returns a tuple without the label.
type Labels ¶
Labels is structure used to represent a set of labels. Labels purpose is to conveniently manipulate many labels.
func (*Labels) Add ¶
Add adds a label l to label set ls. Add returns true if the label has been added, and false otherwise.
func (*Labels) Delete ¶
Delete deletes a label l from label set ls. Delete returns true if the label has been deleted, and false otherwise.
func (*Labels) Intersect ¶
Intersect returns true if both label sets ls and lm intersect, and false otherwise. Intersect returns an intersected label set li if ls and lm intersect, and nil otherwise.
type Signature ¶
type Signature interface{}
Signature represents structure for a signature of values.
func NewSignature ¶
NewSignature creates a hashed signature by recursively traversing the value val. NewSignature expects a recursion depth of rd if it encounters structs, maps or slices.
func NewTypeSignature ¶
NewTypeSignature creates a hashed signature by recursively traversing the value val. NewTypeSignature expects a recursion depth of rd if it encounters structs, maps or slices.
type Template ¶
type Template struct {
Flds []interface{} `bson:"fields" json:"fields" xml:"fields"`
}
Template structure used for matching against tuples. Template is a tuple with type information used for pattern matching.
func NewTemplate ¶
func NewTemplate(fields ...interface{}) (tp Template)
NewTemplate creates a template from the variadic fields provided. NewTemplate encapsulates the types of pointer values.
func (*Template) Apply ¶
Apply iterates through the template tp and applies the function fun to each field. Apply returns true function fun could be applied to all the fields, and false otherwise.
func (*Template) Equal ¶
Equal returns true if both templates tp and tq are strictly equal, and false otherwise.
func (*Template) ExactMatch ¶
ExactMatch returns true if both templates tp and tq are equivalent up to their types and the maximum amount of concrete values matched w.r.t. tq given the amount of concrete values in tp.
func (*Template) Fields ¶
func (tp *Template) Fields() (flds []interface{})
Fields returns the fields of the template.
func (Template) GetDelimiter ¶
GetDelimiter returns the delimiter used to seperated the template fields. GetParenthesisType is used in the String() method.
func (*Template) GetFieldAt ¶
GetFieldAt returns the i'th field of the template.
func (Template) GetParenthesisType ¶
GetParenthesisType returns a pair of strings that encapsulates the template. GetParenthesisType is used in the String() method.
func (*Template) Match ¶
Match returns true if both templates tp and tq are equivalent up to their types, and false otherwise.
type Tuple ¶
type Tuple struct {
Flds []interface{} `bson:"fields" json:"fields" xml:"fields"`
}
Tuple contains a set of fields, where fields can be any primitive or type. A tuple is used to store information which is placed in a tuple space.
func CreateIntrinsicTuple ¶
func CreateIntrinsicTuple(t ...interface{}) (tp Tuple)
CreateIntrinsicTuple creates a intrinsic tuple belonging to template t. CreateIntrinsicTuple initializes according to the template fields in tp by reading of concrete values. If CreateIntrinsicTuple finds a field containing a pointer, this field will be dereferenced and the value read.
func NewTuple ¶
func NewTuple(fields ...interface{}) Tuple
NewTuple create a tuple according to the values in the fields.
func (*Tuple) Apply ¶
Apply iterates through the tuple t and applies the function fun to each field. Apply returns true function fun could be applied to all the fields, and false otherwise.
func (*Tuple) Fields ¶
func (t *Tuple) Fields() (flds []interface{})
Fields returns the fields of the tuple.
func (Tuple) GetDelimiter ¶
GetDelimiter returns the delimiter used to seperated the tuple fields. GetParenthesisType is used in the String() method.
func (*Tuple) GetFieldAt ¶
GetFieldAt returns the i'th field of the tuple.
func (Tuple) GetParenthesisType ¶
GetParenthesisType returns a pair of strings that encapsulates the tuple. GetParenthesisType is used in the String() method.
func (*Tuple) Match ¶
Match pattern matches the tuple against the template tp. Match discriminates between encapsulated formal fields and actual fields. Match returns true if the template matches the tuple, and false otherwise.
func (*Tuple) SetFieldAt ¶
SetFieldAt sets the i'th field of the tuple to the value of val.
func (*Tuple) WriteToVariables ¶
WriteToVariables will overwrite the values pointed to by pointers with the values contained in the tuple. WriteToVariables will ignore unaddressable pointers. TODO: There should be placed a lock around the variables that are being changed, to ensure that mix of two tuple are written to the variables.
type TypeField ¶
type TypeField struct {
TypeStr string `bson:"type" json:"type" xml:"type"`
}
TypeField encapsulate a type.
func CreateTypeField ¶
func CreateTypeField(t interface{}) TypeField
CreateTypeField creates an encapsulation of a type.
func (TypeField) Equal ¶
Equal returns true if both type field a and b are quivalent, and false otherwise.