previous | index | next

Sequence Diagrams 2

The following code segment below could be from a method in the PuzzleConsole class.
        ...
        PuzzleState current = problem.getCurrentState();
        PuzzleState newState = move.doMove(current);
        if ( newState == null ) {
            display("That move is not possible.  Try again.\n");
        }
        else {
            problem.setCurrentState(newState);
            display(newState.toString());
        }
        ... 

Draw a sequence diagram that describes the code segment. Assume that console, problem, current, and move exist when the sequence begins. Also assume that the created newState is not null.


previous | index | next