Skip to content

Commit

Permalink
Updated the documentation of the objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwaa committed May 1, 2021
1 parent 2fd3d96 commit 1b5de43
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
22 changes: 22 additions & 0 deletions matrx/objects/agent_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,26 +418,48 @@ def properties(self, property_dictionary: dict):

@property
def current_action(self):
"""The current action the agent is performing."""
return self.__current_action

@property
def current_action_duration_in_ticks(self):
"""The duration as number of ticks of the current action this agent is performing."""
return self.__last_action_duration_data["duration_in_ticks"]

@property
def current_action_tick_started(self):
"""The tick number at which the agent started its current action."""
return self.__last_action_duration_data["tick"]

@property
def current_action_args(self):
"""The arguments used for the current action this agent is performing."""
return self.__current_action_args

@property
def is_blocked(self):
"""Whether this agent is busy performing an action, thus not being able to select a new action."""
return self.__is_blocked


def _get_all_classes(class_, omit_super_class=False):
""" A private MATRX method.
Returns all classes inheriting from the given class that are currently imported.
Parameters
----------
class_ : Class
The class object to search for its children.
omit_super_class : bool (Default: False)
Whether the given parent class should be included or not.
Returns
-------
dict
A dictionary of class names (keys, strings) and the actual class object (values, Class).
"""
# Include given class or not
if omit_super_class:
subclasses = set()
Expand Down
21 changes: 21 additions & 0 deletions matrx/objects/env_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,34 @@ def properties(self, property_dictionary: dict):


def _next_obj_id():
""" Increments the object counter used to generate unique object IDs.
Returns
-------
int
The increment object counter.
"""
global object_counter
res = object_counter
object_counter += 1
return res


def _get_inheritence_path(callable_class):
""" Returns the parent's class names of the given class.
Parameters
----------
callable_class : Class
The class object for which to return its parent classes.
Returns
-------
list
The list of names of the parent classes.
"""
parents = callable_class.mro()
parents = [str(p.__name__) for p in parents]
return parents

0 comments on commit 1b5de43

Please sign in to comment.