
// GridWord.java
// Andrew Davison, ad@coe.psu.ac.th, Dec. 2022

/* A word located in a word grid, which stores the
   string and its starting and ending (row, column) 
   coordinates.
*/


public class GridWord implements Comparable<GridWord>
{
  private String word;
  private int startR, startC, endR, endC;
         // starting (row,column); ending (row,column)


  public GridWord(String word, int startR, int startC,
                            int endR, int endC)
  {
    this.word = word;
    this.startR = startR; this.startC = startC;
    this.endR = endR; this.endC = endC;
  }  // end of GridWord()


  public String getWord()
  {  return word;  }


  public String toString()
  {  return word + " -- (" + 
                 startR + "," + startC + ")(" +
                 endR + "," + endC + ")";
  }


  public int compareTo(GridWord gw) 
  {   return word.compareTo(gw.word);  }

}  // end of GridWord class