Class Word
java.lang.Object
Word
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 -
Method Summary
Modifier and TypeMethodDescriptionchar
Returns the direction.getWord()
Returns the wordReturns 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
getX()
Returns the row of the word.int
getY()
Returns the column of the word.
-
Constructor Details
-
Word
Creates a word with "position" and "direction" info.- Parameters:
newWord
- the wordnewX
- the rownewY
- the columnnewDirection
- - 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
Returns the word- Returns:
- the word
-
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)
-