barrier
index
/home/gcallah/TandonDevOps/IndraABM/lib/barrier.py

This file defines barrier, a type of group,
which blocks agent's movement

 
Classes
       
lib.group.Group(lib.agent.Agent)
Barrier

 
class Barrier(lib.group.Group)
    Barrier(name, permeable=False)
 
The barrier class
 
 
Method resolution order:
Barrier
lib.group.Group
lib.agent.Agent
builtins.object

Methods defined here:
__init__(self, name, permeable=False)
Should include, dimension of the barrier like height and width,
or a list of coordinates for the inital barrier?
permeable-can agents "jump" over the barrier?
is_blocked(self, coord)
Check if a coordinate is blocked or not
place_barrier(self, coord)
Inserts a barrier agent at the given coordinate if it is
not occupied
remove_barrier(self, coord)
Remove a barrier agent at the given coordinate

Methods inherited from lib.group.Group:
__add__(self, other)
This implements set union and returns
a new Group that is self union other.
If other is an atomic agent, just add it to
this group.
__call__(self, **kwargs)
Call the members' functions, and the group's
action func if it has one.
This should return the total of all
agents who acted in a particular call.
__contains__(self, item)
A test whether item is a member of this set.
__delitem__(self, key)
This will delete a member from this group.
__eq__(self, other)
Return self==value.
__getitem__(self, key)
We are going to return the 'key' member
of our member dictionary.
__iadd__(self, other)
Add other to set self.
If other is a group, add all its members.
If other is an atom, add it.
__iter__(self)
__len__(self)
__repr__(self)
Return repr(self).
__reversed__(self)
__setitem__(self, key, member)
In contrast to agent, which sets a val
for setitem, for groups, we are going to set
the 'key' member.
__sub__(self, other)
This implements set difference.
add_member(self, member)
Should be called by join()
del_member(self, member)
Should be called by split()
from_json(self, serial_obj)
Turn a serilaized JSON stream back into a group:
get_color(self)
Return this group's display color.
get_marker(self)
Return this group's display marker.
get_members(self)
has_color(self)
is_active(self)
For now, groups just stay active.
We might want to revisit later the question
of whether a group with all inactive members
should be inactivated.
is_mbr_comp(self, mbr)
ismember(self, agent)
pop_count(self, mbr)
rand_member(self)
rand_subset(self, n, name='rand_subset', exec_key=None)
Choose a random subset of N members from this group.
restore(self, serial_obj)
Here we restore a group from a serialized object.
subset(self, predicate, *args, name=None, exec_key=None)
to_json(self)
Here we turn a group into a serialized object.

Data and other attributes inherited from lib.group.Group:
__hash__ = None

Methods inherited from lib.agent.Agent:
__str__(self)
Return str(self).
add_group(self, group)
check_null_pos(fn)
Should be used to decorate any function that uses pos[X] or pos[Y]
del_group(self, group)
die(self)
get(self, key, default=None)
This is a call to get_attr() to not break existing code
that calls get().
get_attr(self, key, default=None)
get_pos(self)
get_x(self)
get_y(self)
group_name(self)
is_located(self)
move(self, max_move=None, angle=None)
Move this agent to a random pos within max_move
of its current pos.
prim_group_nm(self)
prim_group is just a name, but we don't want models
going straight at it!
primary_group(self)
set_attr(self, key, val)
set_pos(self, x, y)
set_prim_group(self, group)
We want this to store the name of the group.
The str() of the group is its name.
The str() of the name is itself.
If we are passed None, set to blank.
switch_groups(self, g1, g2)

Data descriptors inherited from lib.agent.Agent:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)