Class Word


public class Word extends Object
Describes a "word" as an element of a crossword: the word (as String), its position and its direction (horizontal or vertical).
Version:
November 2022
Author:
Chrysanthi Raftopoulou
  • Constructor Summary

    Constructors
    Constructor
    Description
    Word(String newWord, int newX, int newY, char newDirection)
    Creates a word with "position" and "direction" info.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    Returns the direction.
    Returns the word
    Returns a string of the form 'w (row,col) d', where 'w' is the word, 'row' and 'col' describe its position and 'd' is the direction.
    int
    Returns the row of the word.
    int
    Returns the column of the word.

    Methods inherited from class java.lang.Object

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

    • Word

      public Word(String newWord, int newX, int newY, char newDirection)
      Creates a word with "position" and "direction" info.
      Parameters:
      newWord - the word
      newX - the row
      newY - the column
      newDirection - - the direction (values 'H' for Horizontal 'V' for Vertical)
  • Method Details

    • getDirection

      public char getDirection()
      Returns the direction.
      Returns:
      the direction 'H' for horizontal 'V' for Vertical
    • getWord

      public String getWord()
      Returns the word
      Returns:
      the word
    • getWordInfo

      public String getWordInfo()
      Returns a string of the form 'w (row,col) d', where 'w' is the word, 'row' and 'col' describe its position and 'd' is the direction.
      Returns:
      the string-representation of the word
    • getX

      public int getX()
      Returns the row of the word.
      Returns:
      the row (x position)
    • getY

      public int getY()
      Returns the column of the word.
      Returns:
      the column (y position)