# Class Cabin

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

All Implemented Interfaces:
  `Serializable`

public class Cabin extends Component
Represents a cabin component in the game, capable of holding human crew members or alien inhabitants with specific life support requirements.

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
  `Cabin(int id, String name, Map<Side,Connector> connector, Side orientation, boolean hasBrownAlienModule, boolean hasPurpleAlienModule)`
  Constructs a cabin with specified modules and orientation

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `addAlien(AlienColor alien)`
  Attempts to add an alien to the cabin if empty
  `String[]`
  `getAsciiArt()`
  Returns an ASCII art representation of the cabin, showing crew or alien status
  `int`
  `getCrewMembers()`
  Returns the current number of crew members
  `AlienColor`
  `getCurrentAlien()`
  Returns the current alien color occupying the cabin
  `boolean`
  `hasBrownAlienLifeSupport()`
  Checks if brown alien life support module is installed
  `boolean`
  `hasPurpleAlienLifeSupport()`
  Checks if purple alien life support module is installed
  `boolean`
  `modifyCrewMembers(int change)`
  Modifies the number of human crew members
  `boolean`
  `removeAlien()`
  Removes the alien from the cabin

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

  `activate, addContains, calculateFirePower, calculateThrust, getAlienColor, getCapacity, getConnector, getConnectors, getContains, getId, getMaxGoodValue, getName, getOrientation, getOrientationShield, getPower, getX, getY, isActive, isAlienLifeSupport, isAlienStructural, modifyCapacity, 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

  - ### Cabin

    public Cabin(int id, String name, Map<Side,Connector> connector, Side orientation, boolean hasBrownAlienModule, boolean hasPurpleAlienModule)
    Constructs a cabin with specified modules and orientation
    Parameters:
      `id` - unique component identifier
      `name` - descriptive name of the cabin
      `connector` - map of side-to-connector mappings
      `orientation` - initial orientation of the component
      `hasBrownAlienModule` - true if brown alien life support module is present
      `hasPurpleAlienModule` - true if purple alien life support module is present

- ## Method Details

  - ### addAlien

    public boolean addAlien(AlienColor alien)
    Attempts to add an alien to the cabin if empty
    Parameters:
      `alien` - AlienColor to add
    Returns:
      true if alien was added, false otherwise

  - ### removeAlien

    public boolean removeAlien()
    Removes the alien from the cabin
    Returns:
      true if an alien was removed, false otherwise

  - ### modifyCrewMembers

    public boolean modifyCrewMembers(int change)
    Modifies the number of human crew members
    Overrides:
      `modifyCrewMembers` in class `Component`
    Parameters:
      `change` - positive to add, negative to remove
    Returns:
      true if operation successful, false otherwise

  - ### hasBrownAlienLifeSupport

    public boolean hasBrownAlienLifeSupport()
    Checks if brown alien life support module is installed
    Returns:
      true if brown module present

  - ### hasPurpleAlienLifeSupport

    public boolean hasPurpleAlienLifeSupport()
    Checks if purple alien life support module is installed
    Returns:
      true if purple module present

  - ### getCrewMembers

    public int getCrewMembers()
    Returns the current number of crew members
    Overrides:
      `getCrewMembers` in class `Component`
    Returns:
      crew member count

  - ### getCurrentAlien

    public AlienColor getCurrentAlien()
    Returns the current alien color occupying the cabin
    Overrides:
      `getCurrentAlien` in class `Component`
    Returns:
      AlienColor or NONE

  - ### getAsciiArt

    public String[] getAsciiArt()
    Returns an ASCII art representation of the cabin, showing crew or alien status
    Overrides:
      `getAsciiArt` in class `Component`
    Returns:
      array of ASCII art lines