object and objects are now private

This commit is contained in:
Chanumask
2023-10-23 16:44:03 +02:00
parent e87bd3aaa0
commit c4ffdb4e44
11 changed files with 30 additions and 30 deletions

View File

@@ -3,13 +3,13 @@ from collections import defaultdict
import numpy as np
from .object import Object
from .object import _Object
from .. import constants as c
from ...utils.results import ActionResult
from ...utils.utility_classes import RenderEntity
class Entity(Object, abc.ABC):
class Entity(_Object, abc.ABC):
"""Full Env Entity that lives on the environment Grid. Doors, Items, DirtPile etc..."""
_u_idx = defaultdict(lambda: 0)

View File

@@ -4,7 +4,7 @@ from typing import Union
from marl_factory_grid.environment import constants as c
class Object:
class _Object:
"""Generell Objects for Organisation and Maintanance such as Actions etc..."""
_u_idx = defaultdict(lambda: 0)
@@ -66,8 +66,8 @@ class Object:
return hash(self.identifier)
def _identify_and_count_up(self):
idx = Object._u_idx[self.__class__.__name__]
Object._u_idx[self.__class__.__name__] += 1
idx = _Object._u_idx[self.__class__.__name__]
_Object._u_idx[self.__class__.__name__] += 1
return idx
def set_collection(self, collection):
@@ -92,7 +92,7 @@ class Object:
return self._bound_entity == entity
class EnvObject(Object):
class EnvObject(_Object):
"""Objects that hold Information that are observable, but have no position on the environment grid. Inventories etc..."""
_u_idx = defaultdict(lambda: 0)

View File

@@ -3,7 +3,7 @@ import math
import numpy as np
from marl_factory_grid.environment.entity.mixin import BoundEntityMixin
from marl_factory_grid.environment.entity.object import Object, EnvObject
from marl_factory_grid.environment.entity.object import _Object, EnvObject
##########################################################################
@@ -11,7 +11,7 @@ from marl_factory_grid.environment.entity.object import Object, EnvObject
##########################################################################
class PlaceHolder(Object):
class PlaceHolder(_Object):
def __init__(self, *args, fill_value=0, **kwargs):
super().__init__(*args, **kwargs)
@@ -30,7 +30,7 @@ class PlaceHolder(Object):
return "PlaceHolder"
class GlobalPosition(Object):
class GlobalPosition(_Object):
@property
def encoding(self):