package eecs2030.lab5;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* A controller that mediates the interaction between an RPSModel and an RPSView.
*
*/
public class RPSController implements ActionListener {
private RPSModel model;
private RPSView view;
/**
* Returns the RPSModel used by this controller.
*
* @return the model
*/
public RPSModel getModel() {
return this.model;
}
/**
* Sets the RPSModel used by this controller.
*
* @param model the model to set
*/
public void setModel(RPSModel model) {
this.model = model;
}
/**
* Returns the RPSView used by this controller.
*
* @return the view
*/
public RPSView getView() {
return this.view;
}
/**
* Sets the RPSView used by this controller.
*
* @param view the view to set
*/
public void setView(RPSView view) {
this.view = view;
}
/**
* Processes an event initiated by a user clicking on a button in an RPSView.
*
* The ActionEvent
object has-a string equal to one of
* RPSUtils.ROCK
, RPSUtils.PAPER
, or RPSUtils.SCISSORS
* indicating which hand the player has chosen.
*
* This method needs to orchestrate a series of method calls to the model
* and view:
*
*