java.lang.Object
model.logic.host.data.Word
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe allTilesAreNulls function checks to see if all the tiles in a word are null.booleanThe equals function checks if two words are equal.intgetCol()The getCol function returns the column of the current position.intgetRow()The getRow function returns the row of the current position.Tile[]getTiles()The getTiles function returns the tiles array.inthashCode()The hashCode function is used to generate a unique hash code for each object.booleanThe hasNullTiles function checks to see if there are any null tiles in the array.booleanThe isVertical function returns a boolean value that indicates whether the current instance of the class is vertical or not.voidThe setTiles function is used to set the tiles of a given board.
-
Constructor Details
-
Word
The Word function is a constructor that takes in the tiles, row, column and vertical of the word.- Parameters:
tiles- tiles Store the tiles that make up the wordrow- row Set the row of the wordcol- col Set the column of the wordvertical- vertical Determine whether the word is vertical or horizontal
-
-
Method Details
-
setTiles
The setTiles function is used to set the tiles of a given board.- Parameters:
tiles- tiles Set the tiles array to the value of temp
-
getTiles
The getTiles function returns the tiles array.- Returns:
- An array of tile objects
-
getRow
public int getRow()The getRow function returns the row of the current position.- Returns:
- The row of the cell
-
getCol
public int getCol()The getCol function returns the column of the current position.- Returns:
- The column of the current position
-
isVertical
public boolean isVertical()The isVertical function returns a boolean value that indicates whether the current instance of the class is vertical or not.- Returns:
- A boolean value that indicates if the line is vertical or not
-
equals
The equals function checks if two words are equal. -
hashCode
public int hashCode()The hashCode function is used to generate a unique hash code for each object. This function uses the row, col, vertical and tiles fields of the WordSearchPuzzle class to generate a unique hash code for each object. The hashCode function is used in conjunction with the equals method so that two objects can be compared by their contents rather than their memory location. -
hasNullTiles
public boolean hasNullTiles()The hasNullTiles function checks to see if there are any null tiles in the array.- Returns:
- True if there is a null tile in the tiles array and false otherwise
-
allTilesAreNulls
public boolean allTilesAreNulls()The allTilesAreNulls function checks to see if all the tiles in a word are null.- Returns:
- True if all the tiles are nulls
-