public void attachToPuzzleDetails(HeyawakePuzzleDetails puzzleDetails)
throws InvalidObjectException, ObjectAlreadyInitializedException {
super.attachToPuzzleDetails(puzzleDetails);
if (getWidth() <= 0 || getHeight() <= 0) {
throw new InvalidObjectException("HeyawakePuzzleDetails has an invalid width or height.");
}
if (rooms == null) {
rooms = new ArrayList<HeyawakeRoom>();
}
if (stateArray == null) {
stateArray = new HeyawakeCellState[getWidth()][getHeight()];
} else if (stateArray.length != getWidth() ||
stateArray[0].length != getWidth()) {
throw new InvalidObjectException("Width or height of HeyawakePuzzle doesn't match that of HeyawakePuzzleDetails");
}
}