ArtifactForms/MeshLibCore

View on GitHub
src/main/java/engine/components/AbstractComponent.java

Summary

Maintainability
A
0 mins
Test Coverage
package engine.components;

import engine.scene.SceneNode;

/**
 * Abstract base class for all components in the scene graph.
 *
 * <p>This class provides a shared implementation of common functionality across all components,
 * reducing boilerplate and centralizing shared logic for ease of maintenance.
 */
public abstract class AbstractComponent implements Component {

  /** Reference to the owning SceneNode */
  protected SceneNode owner;

  /**
   * Sets the owner (parent node) of this component.
   *
   * <p>This is common logic provided by the abstract class to ensure consistency among all
   * components.
   *
   * @param owner The SceneNode that owns this component.
   */
  @Override
  public void setOwner(SceneNode owner) {
    this.owner = owner;
  }

  /**
   * Retrieves the owning node for convenience.
   *
   * @return The owning SceneNode instance.
   */
  public SceneNode getOwner() {
    return owner;
  }
}