Class Player

java.lang.Object
model.logic.host.data.Player
All Implemented Interfaces:
Serializable

public class Player extends Object implements Serializable
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Player(String name)
    The Player function is a constructor for the Player class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTile(Tile tile)
    The addTile function adds a tile to the tiles' arraylist.
    The getAllTiles function returns a list of all the tiles in the game.
    The getName function returns the name of the person.
    int
    The getScore function returns the score of the player.
    getTile(char letter)
    The getTile function takes in a letter and returns the tile with that letter.
    void
    The setName function sets the name of the person.
    void
    setScore(int score)
    The setScore function sets the score of a player.
    void
    setTiles(List<Tile> tiles)
    The setTiles function is used to set the tiles of a board.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Player

      public Player(String name)
      The Player function is a constructor for the Player class. It takes in a String name and sets it as the player's name, initializes their score to 0, and creates an ArrayList of Tiles called tiles.
      Parameters:
      name - name Set the name of the player
  • Method Details

    • getName

      public String getName()
      The getName function returns the name of the person.
      Returns:
      The name of the student
    • setName

      public void setName(String name)
      The setName function sets the name of the person.
      Parameters:
      name - name Set the name of the object
    • getScore

      public int getScore()
      The getScore function returns the score of the player.
      Returns:
      The score of the player
    • setScore

      public void setScore(int score)
      The setScore function sets the score of a player.
      Parameters:
      score - score Set the score of the player
    • getTile

      public Tile getTile(char letter)
      The getTile function takes in a letter and returns the tile with that letter.
      Parameters:
      letter - letter Find the tile with the corresponding letter
      Returns:
      The tile with the given letter
    • getAllTiles

      public List<Tile> getAllTiles()
      The getAllTiles function returns a list of all the tiles in the game.
      Returns:
      A list of all the tiles in the game
    • setTiles

      public void setTiles(List<Tile> tiles)
      The setTiles function is used to set the tiles of a board.
      Parameters:
      tiles - <Tile> tiles Set the tiles of a board
    • addTile

      public void addTile(Tile tile)
      The addTile function adds a tile to the tiles' arraylist.
      Parameters:
      tile - tile Add a tile to the tiles arraylist