metawards.movers.MoveRecord
- class metawards.movers.MoveRecord[source]
This class holds a record of mover-initiated moves. This could be used, to reverse moves, e.g. to send individuals back from home hospital, or to send individuals back home from holiday
Methods
__delattr__
(name, /)Implement delattr(self, name).
__dir__
()Default dir() implementation.
__eq__
(value, /)Return self==value.
__format__
(format_spec, /)Default object formatter.
__ge__
(value, /)Return self>=value.
__getattribute__
(name, /)Return getattr(self, name).
__getitem__
(i)__gt__
(value, /)Return self>value.
__hash__
()Return hash(self).
__init__
()__init_subclass__
This method is called when a class is subclassed.
__le__
(value, /)Return self<=value.
__len__
()__lt__
(value, /)Return self<value.
__ne__
(value, /)Return self!=value.
__new__
(**kwargs)__reduce__
()Helper for pickle.
__reduce_ex__
(protocol, /)Helper for pickle.
__repr__
()Return repr(self).
__setattr__
(name, value, /)Implement setattr(self, name, value).
__sizeof__
()Size of object in memory, in bytes.
__str__
()Return str(self).
__subclasshook__
Abstract classes can override this to customize issubclass().
add
(from_stage, to_stage, from_type, ...[, ...])Record the move from the specified demographic, stage type and ward to the specified demographic, stage, type and ward, recording the number of individuals who made this move.
invert
()Return a copy of this record with the moves inverted - i.e. a move of X -> Y of 10 individuals will become a move from Y -> X of 10 individuals.
Attributes
__dict__
__doc__
__module__
__weakref__
list of weak references to the object (if defined)
- add(from_stage: int, to_stage: int, from_type: metawards._network.PersonType, to_type: metawards._network.PersonType, from_ward: int, to_ward: int, from_demographic: int = 0, to_demographic: int = 0, number: int = 1)[source]
Record the move from the specified demographic, stage type and ward to the specified demographic, stage, type and ward, recording the number of individuals who made this move.
If the type is PLAYER, then the ward is the ward index If the type is WORKER, then the ward is the link index
- invert() metawards.movers._moverecord.MoveRecord [source]
Return a copy of this record with the moves inverted - i.e. a move of X -> Y of 10 individuals will become a move from Y -> X of 10 individuals. Use this, together with MoveGenerator, to reverse moves