Class ReadOnlySpinHexModelWrapper

java.lang.Object
spinhex.model.SpinHexModel
spinhex.model.ReadOnlySpinHexModelWrapper
All Implemented Interfaces:
common.State<TwoPhaseActionState.TwoPhaseAction<AxialPosition, Rotation>>, Cloneable, puzzle.State<TwoPhaseActionState.TwoPhaseAction<AxialPosition, Rotation>>, TwoPhaseActionState<AxialPosition, Rotation>

public class ReadOnlySpinHexModelWrapper extends SpinHexModel
A read-only wrapper for the SpinHex model that provides access to the board properties without allowing modifications.

This class extends the SpinHexModel and provides a read-only view of the board, allowing access to hex values at specific axial coordinates.

  • Constructor Details

    • ReadOnlySpinHexModelWrapper

      public ReadOnlySpinHexModelWrapper()
      Constructs a read-only wrapper for a SpinHex model with the default board. Initializes the board properties to reflect the current state of the board.
    • ReadOnlySpinHexModelWrapper

      public ReadOnlySpinHexModelWrapper(byte[][] startingBoard, byte[][] targetBoard)
      Constructs a read-only wrapper for a SpinHex model with the specified starting and target boards.
      Parameters:
      startingBoard - The initial state of the board as a 2D byte array
      targetBoard - The target state of the board as a 2D byte array
  • Method Details

    • getHexProperty

      public javafx.beans.property.ReadOnlyIntegerProperty getHexProperty(int q, int s)
      Returns a read-only property for the hex at the specified axial coordinates.
      Parameters:
      q - The q-coordinate of the hex
      s - The s-coordinate of the hex
      Returns:
      A read-only integer property representing the hex value
    • makeMove

      public void makeMove(TwoPhaseActionState.TwoPhaseAction<AxialPosition, Rotation> moveAction)
      Makes a move in the SpinHex model and updates the property model accordingly.
      Specified by:
      makeMove in interface common.State<TwoPhaseActionState.TwoPhaseAction<AxialPosition, Rotation>>
      Overrides:
      makeMove in class SpinHexModel
      Parameters:
      moveAction - The move action to perform.