# Class Engine

java.lang.Object
it.polimi.ingsw.is25am31.model.components.Component
it.polimi.ingsw.is25am31.model.components.Engine

All Implemented Interfaces:
  `Serializable`

public class Engine extends Component
The Engine class represents an engine component that extends the Component class. It models the behavior and properties of an engine, which includes thrust calculations, activation for multi-power engines, and ASCII art representation.

See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class it.polimi.ingsw.is25am31.model.components.Component

  `connector, id, name, orientation, x, y`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Engine(int id, String name, Map<Side,Connector> connector, Side orientation, int power)`
  Constructs an engine with specified power and orientation

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `activate()`
  Activates this multi-power engine for the next thrust calculation
  `int`
  `calculateThrust()`
  Calculates thrust produced by the engine this turn Single engines only thrust if connector points back; multi engines thrust when active, then deactivate
  `String[]`
  `getAsciiArt()`
  Returns an ASCII art representation of the engine, showing orientation arrows and power label
  `boolean`
  `isActive()`
  Checks if this multi-power engine is currently active

  ### Methods inherited from class it.polimi.ingsw.is25am31.model.components.Component

  `addContains, calculateFirePower, getAlienColor, getCapacity, getConnector, getConnectors, getContains, getCrewMembers, getCurrentAlien, getId, getMaxGoodValue, getName, getOrientation, getOrientationShield, getPower, getX, getY, isAlienLifeSupport, isAlienStructural, modifyCapacity, modifyCrewMembers, modifyOrientation, protectedSides, removeContains, setOrientationShield, setX, setY`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Engine

    public Engine(int id, String name, Map<Side,Connector> connector, Side orientation, int power)
    Constructs an engine with specified power and orientation
    Parameters:
      `id` - unique component identifier
      `name` - descriptive name of the engine
      `connector` - map of side-to-connector mappings
      `orientation` - initial orientation of the component
      `power` - thrust power rating

- ## Method Details

  - ### calculateThrust

    public int calculateThrust()
    Calculates thrust produced by the engine this turn Single engines only thrust if connector points back; multi engines thrust when active, then deactivate
    Overrides:
      `calculateThrust` in class `Component`
    Returns:
      thrust units generated

  - ### isActive

    public boolean isActive()
    Checks if this multi-power engine is currently active
    Overrides:
      `isActive` in class `Component`
    Returns:
      true if active; single engines throw if queried

  - ### activate

    public void activate()
    Activates this multi-power engine for the next thrust calculation
    Overrides:
      `activate` in class `Component`

  - ### getAsciiArt

    public String[] getAsciiArt()
    Returns an ASCII art representation of the engine, showing orientation arrows and power label
    Overrides:
      `getAsciiArt` in class `Component`
    Returns:
      array of ASCII art lines