# Class Tiles

java.lang.Object
it.polimi.ingsw.is25am31.model.components.Tiles

public class Tiles extends Object
The Tiles class represents a collection of components used within the game. It manages components classified as face-down, face-up, used, and an overall list of all components. The class provides functionality for drawing components, managing their state, and ensuring rules are followed for their usage.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Tiles(int level)`
  Reads the components from the JSON file and puts them in `faceDownComponents`.
  If the specified level is 1 (test flight), replaces all the alien life support components with structural components as per game rules

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Component`
  `getComponent(int id)`
  `Component`
  `getFaceDownComponent()`
  + Drawn component is moved from face down components to used components (unavailable to be drawn)
  `void`
  `getFaceUpComponent(Component component)`
  Drawn component is moved from face up components to used components (unavailable to be drawn)
  `List<Component>`
  `getFaceUpComponentsList()`
  `void`
  `putDownComponent(Component component)`
  Put down component is moved from used components (unavailable to be drawn) to face up components

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

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

- ## Constructor Details

  - ### Tiles

    public Tiles(int level)
    Reads the components from the JSON file and puts them in `faceDownComponents`.
    If the specified level is 1 (test flight), replaces all the alien life support components with structural components as per game rules
    Parameters:
      `level` - level of the game

- ## Method Details

  - ### getComponent

    public Component getComponent(int id)
    Parameters:
      `id` - id of the required component
    Returns:
      component with the specified id

  - ### getFaceDownComponent

    public Component getFaceDownComponent()
    + Drawn component is moved from face down components to used components (unavailable to be drawn)
    Returns:
      a random face down component

  - ### getFaceUpComponent

    public void getFaceUpComponent(Component component)
    Drawn component is moved from face up components to used components (unavailable to be drawn)
    Parameters:
      `component` - component to be drawn form face up components

  - ### putDownComponent

    public void putDownComponent(Component component)
    Put down component is moved from used components (unavailable to be drawn) to face up components
    Parameters:
      `component` - component to be put down

  - ### getFaceUpComponentsList

    public List<Component> getFaceUpComponentsList()
    Returns:
      list of face up components