Interface TwoPhaseActionState<T,U>

Type Parameters:
T - the type of the source element (from where an action originates)
U - the type of the action to be performed
All Superinterfaces:
Cloneable, common.State<TwoPhaseActionState.TwoPhaseAction<T,U>>, puzzle.State<TwoPhaseActionState.TwoPhaseAction<T,U>>
All Known Implementing Classes:
ReadOnlySpinHexModelWrapper, SpinHexModel

public interface TwoPhaseActionState<T,U> extends puzzle.State<TwoPhaseActionState.TwoPhaseAction<T,U>>
Represents a state in a two-phase action system where actions are performed in two distinct phases: first selecting a source element, then specifying the action to perform from that source.

This interface extends the State interface with a specialized action type that encapsulates both the source element and the action to be performed.

See Also:
  • State
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Represents a two-phase action consisting of a source element and the action to be performed.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determines whether it is legal to initiate an action from the specified source.

    Methods inherited from interface common.State

    isLegalMove, makeMove

    Methods inherited from interface puzzle.State

    clone, getLegalMoves, isSolved
  • Method Details

    • isLegalToMoveFrom

      boolean isLegalToMoveFrom(T from)
      Determines whether it is legal to initiate an action from the specified source.
      Parameters:
      from - the source element to check
      Returns:
      true if an action can be initiated from the specified source, false otherwise