SGSolve
SGGameHandler Class Reference

This class handles the widgets for editing/displaying the game. More...

#include <sggamehandler.hpp>

Inheritance diagram for SGGameHandler:
Collaboration diagram for SGGameHandler:

Public Slots

void setConstrained (int newState)
 Changes whether or not feasible set will be calculated.
 

Public Member Functions

 SGGameHandler ()
 Constructor. More...
 
 ~SGGameHandler ()
 Destructor. More...
 
void setGame (const SGGame &_game)
 Replaces the current game with _game. More...
 
const SGGamegetGame () const
 Returns constant reference to the current game.
 
double getErrorTol () const
 Returns the error tolerance.
 
QVBoxLayout * getLayout () const
 Returns the layout.
 
QPushButton * getSolveButton () const
 Returns the solveButton.
 
QPushButton * getSolveButton_V2 () const
 Returns the solveButton_V2.
 
QPushButton * getCancelButton () const
 Returns the cancelButton.
 
void setState (int state)
 Changes the current state. More...
 

Private Slots

void currentStateChanged (int newS)
 Slot for changing the state. Calls setState.
 
void stateAdded ()
 Adds a new state. Calls changeNumberOfStates.
 
void action1Added ()
 Action added for player 1. Calls actionAdded.
 
void action2Added ()
 Action added for player 2. Calls actionAdded.
 
void actionAdded (int player)
 Adds a new action for the indicated player.
 
void stateRemoved ()
 Removes the current state.
 
void action1Removed ()
 Action removed for player 1. Calls actionRemoved.
 
void action2Removed ()
 Action removed for player 2. Calls actionRemoved.
 
void actionRemoved (int player)
 Removes action for the given player. More...
 
void discountFactorChanged (const QString &text)
 Changes the discount factor.
 
void errorTolChanged (const QString &text)
 Changes the error tolerance.
 
void nextState ()
 Advances currentState to the next state.
 
void prevState ()
 Decreases currentState to the previous state.
 

Private Member Functions

void initializeModels ()
 Delete old data models and create new ones. More...
 
void pushBackProbabilityTable (int newS)
 Adds a new probability table model.
 
void popBackProbabilityTable ()
 Removes last probability table model.
 
void changeNumberOfStates (int newS)
 Adds/removes models to achieve correct number of states.
 

Private Attributes

SGGame game
 The game object. More...
 
double errorTol
 Error tolerance for measuring convergence.
 
SGPayoffTableModelpayoffModel
 The model for interfacing with payoffs.
 
vector< SGProbabilityTableModel * > probabilityModels
 Vector of models for interfacing with transition probabilities.
 
QVBoxLayout * layout
 Layout for the game tab.
 
QPushButton * solveButton
 Button that triggers solve routine.
 
QPushButton * solveButton_V2
 Button that triggers solve routine.
 
QPushButton * cancelButton
 Button that cancels solve.
 
QLineEdit * deltaEdit
 For editing the discount factor.
 
vector< QLineEdit * > numActionsEdits
 Vector of edits for players' numbers of actions.
 
QLineEdit * numStatesEdit
 Edit for number of states.
 
QLineEdit * errorTolEdit
 Edit for controlling error tolerance.
 
QComboBox * currentStateCombo
 Drop down menu for selecting a state.
 
QTableView * payoffTableView
 Table for displaying stage payoffs.
 
vector< SGTableView * > probabilityTableViews
 Vector of tables for displaying transition probabilities.
 
QVBoxLayout * probabilityTableLayout
 Layout for holding transition probability tables.
 
QCheckBox * feasibleCheckBox
 Check box for whether or not to calculate feasible set.
 

Detailed Description

This class handles the widgets for editing/displaying the game.

All of the widgets in the game tab and their slots are members of this class. It also contains the pointer to the SGGame, and handles the interfaces to the game objects.

The class contains table models for editing the game, which interface with the respective data using the SGGame class's interface methods.

For a more detailed description, see viewergametabsec.

Constructor & Destructor Documentation

◆ SGGameHandler()

SGGameHandler::SGGameHandler ( )

Constructor.

Constructs edits and buttons, connects signals/slots, calls SGGameHandler::initializeModels.

◆ ~SGGameHandler()

SGGameHandler::~SGGameHandler ( )

Destructor.

Destroys probability table views, models, etc.

Member Function Documentation

◆ actionRemoved

void SGGameHandler::actionRemoved ( int  player)
privateslot

Removes action for the given player.

Will remove the action that is currently selected in the payoff table, if one is selected.

◆ initializeModels()

void SGGameHandler::initializeModels ( )
private

Delete old data models and create new ones.

Called in constructor and whenever game changes.

◆ setGame()

void SGGameHandler::setGame ( const SGGame _game)

Replaces the current game with _game.

Calls initializeModels to reinitialize references for table models.

◆ setState()

void SGGameHandler::setState ( int  state)

Changes the current state.

Switches all of the models over to new state and updates table views.

Member Data Documentation

◆ game

SGGame SGGameHandler::game
private

The game object.

This is the game that is represented in the game tab. Note that this can be a different game than the one that is associated with the solution in the solution tab.


The documentation for this class was generated from the following files: