Mixins¶
The galactic.context.mixins
package defines mixins classes for defining new types of
contexts:
ConcreteIndividual
for defining individuals that own their identifier as a fieldConcreteAttribute
for defining attributes that own their name and their type as fieldsContextHolder
for defining elements that own their context as a fieldPopulationHolder
for defining elements that own their population as a fieldModelHolder
for defining elements that own their model as a fieldAttributesHolder
for defining models that own their attributes as a fieldIndividualsHolder
for defining population that own their individuals as a fieldValuesHolder
for defining individuals that own their values as a field
They are widely used for defining
in the galactic.context.memory
package.
New in version 0.0.1.
-
class
galactic.context.mixins.
ConcreteIndividual
(**kwargs)[source]¶ The
ConcreteIndividual
class is a mixin used in subclassing theIndividual
class for storing their identifier as a field.New in version 0.0.1.
-
class
galactic.context.mixins.
ConcreteAttribute
(**kwargs)[source]¶ The
ConcreteAttribute
class is a mixin used in subclassing theAttribute
class for storing their name and their type as a class.New in version 0.0.1.
-
class
galactic.context.mixins.
ContextHolder
(**kwargs)[source]¶ The
ContextHolder[C]
is a mixin used for storing an element context as a field.It’s a generic class that depends of a
Context
subclassC
.New in version 0.0.1.
-
__init__
(**kwargs)[source]¶ Initialise an element by setting its context.
Keyword Arguments: context ( C
) – the contextNew in version 0.0.1.
-
context
¶ Get the context.
Returns: the context Return type: C
New in version 0.0.1.
-
-
class
galactic.context.mixins.
PopulationHolder
(**kwargs)[source]¶ The
PopulationHolder[P]
is a mixin used for storing an element population as a field.It’s a generic class that depends of a
Population
subclassP
.New in version 0.0.1.
-
__init__
(**kwargs)[source]¶ Initialise an element by setting its population.
Keyword Arguments: population ( P
) – the populationNew in version 0.0.1.
-
population
¶ Get the population.
Returns: the population Return type: P
New in version 0.0.1.
-
-
class
galactic.context.mixins.
ModelHolder
(**kwargs)[source]¶ The
ModelHolder[M]
class is a mixin used for storing an element model as a field.It’s a generic class that depends of a
Model
subclassM
.New in version 0.0.1.
-
__init__
(**kwargs)[source]¶ Initialise an element by setting its model.
Keyword Arguments: model ( M
) – the modelNew in version 0.0.1.
-
model
¶ Get the model.
Returns: the model Return type: M
New in version 0.0.1.
-
-
class
galactic.context.mixins.
AttributesHolder
(**kwargs)[source]¶ The
AttributesHolder[A]
class is a mixin used for storing the model attributes in memory.It’s a generic class that depends of an
Attribute
subclassA
.New in version 0.0.1.
-
__init__
(**kwargs)[source]¶ Initialise an attribute holder.
Keyword Arguments: attributes ( Iterable[A]
) – the attributesNew in version 0.0.1.
-
-
class
galactic.context.mixins.
IndividualsHolder
(**kwargs)[source]¶ The
IndividualsHolder[X]
class is a mixin used for storing the population individuals in memory.It’s a generic class that depends of an
Individual
subclassX
.New in version 0.0.1.
-
__init__
(**kwargs)[source]¶ Initialise an individuals holder.
Keyword Arguments: individuals ( Iterable[A]
) – the individualsNew in version 0.0.1.
-
-
class
galactic.context.mixins.
ValuesHolder
(**kwargs)[source]¶ The
ValuesHolder[A]
class is a mixin for storing the individual values in memory.It’s a generic class that depends of an
Attribute
subclassA
.New in version 0.0.1.
-
__init__
(**kwargs)[source]¶ Initialise a values holder.
Keyword Arguments: values ( Mapping[str, object]
) – the initial (name, value) pairsNew in version 0.0.1.
-