Body Services

Services for body objects in the Hiten framework.

Body Persistence Service

_BodyPersistenceService()

Encapsulate IO helpers for bodies to simplify testing and substitution.

class hiten.algorithms.types.services.body._BodyPersistenceService[source]

Bases: _PersistenceServiceBase

Encapsulate IO helpers for bodies to simplify testing and substitution.

Parameters:
  • save_fn (Callable[..., Any]) – The function to save the object.

  • load_fn (Callable[..., Any]) – The function to load the object.

  • load_inplace_fn (Optional[Callable[..., Any]] = None) – The function to load the object in place.

Body Dynamics Service

_BodyDynamicsService()

Encapsulate dynamics helpers for bodies to simplify testing and substitution.

class hiten.algorithms.types.services.body._BodyDynamicsService(body)[source]

Bases: _DynamicsServiceBase

Encapsulate dynamics helpers for bodies to simplify testing and substitution.

Parameters:
  • domain_obj (Body) – The domain object.

  • body (Body)

property name: str

Get the name of the body.

property mass: float

Get the mass of the body.

property radius: float

Get the radius of the body.

property color: str

Get the color of the body.

property parent: Body

Get the parent of the body.

Body Services

_BodyServices()

Encapsulate services for bodies.

class hiten.algorithms.types.services.body._BodyServices(domain_obj, persistence, dynamics)[source]

Bases: _ServiceBundleBase

Encapsulate services for bodies.

Parameters:
  • domain_obj (Body) – The domain object.

  • persistence (_BodyPersistenceService) – The persistence service.

  • dynamics (_BodyDynamicsService) – The dynamics service.

classmethod default(domain_obj)[source]

Create a default service bundle.

Parameters:

domain_obj (Body) – The domain object.

Returns:

The service bundle.

Return type:

_BodyServices

classmethod with_shared_dynamics(dynamics)[source]

Create a service bundle with a shared dynamics service.

Parameters:

dynamics (_BodyDynamicsService) – The dynamics service.

Returns:

The service bundle.

Return type:

_BodyServices