public class MainGUI extends javax.swing.JFrame implements ObserverAnimation
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
private javax.swing.JFileChooser |
chooser
File Chooser for saving the results
|
static int |
COLUMN_LENGTH
Column Length for saving several simulations
|
private int |
contSim
Counter for the number of simulation that is being run
|
static java.nio.charset.Charset |
ENCODING
Encoding
|
private javax.swing.JButton |
jButtonRunSimulation |
private javax.swing.JButton |
jButtonSaveResults |
private javax.swing.JComboBox |
jComboBoxSpeed |
private javax.swing.JLabel |
jLabel1 |
private javax.swing.JLabel |
jLabel2 |
private javax.swing.JLabel |
jLabel3 |
private javax.swing.JLabel |
jLabel4 |
private javax.swing.JLabel |
jLabel5 |
private javax.swing.JLabel |
jLabel6 |
private javax.swing.JLabel |
jLabel7 |
private javax.swing.JLabel |
jLabelCouple |
private javax.swing.JLabel |
jLabelFamilyBabies |
private javax.swing.JLabel |
jLabelFamilyWithoutBabies |
private javax.swing.JLabel |
jLabelFriends |
private javax.swing.JLabel |
jLabelInput1 |
private javax.swing.JLabel |
jLabelIterations |
private javax.swing.JScrollPane |
jScrollPane1 |
private javax.swing.JScrollPane |
jScrollPane2 |
private javax.swing.JScrollPane |
jScrollPane3 |
private javax.swing.JTable |
jTable1 |
private javax.swing.JTable |
jTableResults |
private javax.swing.JTable |
jTableSummary |
private javax.swing.JTextField |
jTextFieldIterations |
private javax.swing.JTextField |
jTextFieldJoker |
private javax.swing.JTextField |
jTextFieldNumSimulations |
private javax.swing.JTextField |
jTextFieldObstructive |
private javax.swing.JTextField |
jTextFieldOccasional |
private javax.swing.JTextField |
jTextFieldParticipant |
private javax.swing.JTextField |
jTextFieldQuite |
private javax.swing.JTextField |
jTextFieldTangent |
(package private) MeasurementEvolutionSociogram |
measurement
Reference to the Measurement Evolution of Sociograms
|
private MeasurementEvolutionSociogram[] |
measurements
Measurement evolutions of each simulation
|
static int |
NUM_SUMMARIES
Num of summaries (for now 2, Averages and Standard Deviatons
|
private int |
numSimulations
Number of Simulations
|
private double[][] |
results
Matrix of NxM values where N is the number of simulations and
M is the number of metrics.
|
private SimulationAnimation |
simulation
Current simulation
|
(package private) SociogramGUI |
sociogramGUI
Reference to the Sociogram GUI
|
private Sociogram[] |
sociograms
Final sociogram of each simulation
|
private double[][] |
summary
This matrix stores the summarizes of the results for each metric.
|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
MainGUI()
Creates new form MainGUI
|
Modifier and Type | Method and Description |
---|---|
void |
calculateSummary()
Calculates the summary of the results (averages and standard
deviations
|
void |
changeSizeJTableResults(int numRows)
It changes the number of rows of jTableResults, so users can define
an unlimited number of simulations.
|
void |
clearJTableSummary()
It clears the table with the summaries
|
private void |
createAgents()
Creates the agents and register these in the
simulation
|
private void |
initComponents()
This method is called from within the constructor to initialize the form.
|
void |
initOtherComponents()
Init other components manually indtroduced by the programmer
|
private void |
jButtonSaveResultsActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jComboBoxSpeedActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldIterationsActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldJokerActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldNumSimulationsActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldObstructiveActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldOccasionalActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldParticipantActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldQuiteActionPerformed(java.awt.event.ActionEvent evt) |
private void |
jTextFieldTangentActionPerformed(java.awt.event.ActionEvent evt) |
static void |
main(java.lang.String[] args) |
void |
performSeveralSimulations()
Starts the running of several simulations, and the end of each
simulation is notified through the undateFinishedSimulation method."
|
private void |
performSimulation()
Performs a simulation according to the data
|
private int |
readIterations()
Returns the number of iterations indicated by the user
|
private int |
readSimulations()
Returns the number of simulations indicated by the user
|
private double |
readSpeed()
Returns the speed (iterations/second) of the simulation indicated
by the user
|
private void |
runSimulationActionPerformed(java.awt.event.ActionEvent evt)
Method for running the simulations, executed when pressing the "Run
Simulation" button.
|
void |
saveInputParameters(java.io.PrintStream out) |
void |
saveJTable(javax.swing.JTable jtable,
java.io.PrintStream out,
int numRows)
It saves the contents of the JTable.
|
void |
saveSeveralSimulations(java.io.PrintStream out)
It saves several simulations
|
private void |
showResults()
Shows the results of the simulation.
|
void |
showSummary()
It shows the summary in the GUI
|
void |
updateFinishedSimulation()
When a simulation is finished (notified as an observer), it records
the state of the finished simulation, and starts the next simulation
if necessary.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private SimulationAnimation simulation
SociogramGUI sociogramGUI
MeasurementEvolutionSociogram measurement
private MeasurementEvolutionSociogram[] measurements
private Sociogram[] sociograms
private int numSimulations
private int contSim
private double[][] results
private double[][] summary
private javax.swing.JFileChooser chooser
public static int NUM_SUMMARIES
public static final java.nio.charset.Charset ENCODING
public static final int COLUMN_LENGTH
private javax.swing.JButton jButtonRunSimulation
private javax.swing.JButton jButtonSaveResults
private javax.swing.JComboBox jComboBoxSpeed
private javax.swing.JLabel jLabel1
private javax.swing.JLabel jLabel2
private javax.swing.JLabel jLabel3
private javax.swing.JLabel jLabel4
private javax.swing.JLabel jLabel5
private javax.swing.JLabel jLabel6
private javax.swing.JLabel jLabel7
private javax.swing.JLabel jLabelCouple
private javax.swing.JLabel jLabelFamilyBabies
private javax.swing.JLabel jLabelFamilyWithoutBabies
private javax.swing.JLabel jLabelFriends
private javax.swing.JLabel jLabelInput1
private javax.swing.JLabel jLabelIterations
private javax.swing.JScrollPane jScrollPane1
private javax.swing.JScrollPane jScrollPane2
private javax.swing.JScrollPane jScrollPane3
private javax.swing.JTable jTable1
private javax.swing.JTable jTableResults
private javax.swing.JTable jTableSummary
private javax.swing.JTextField jTextFieldIterations
private javax.swing.JTextField jTextFieldJoker
private javax.swing.JTextField jTextFieldNumSimulations
private javax.swing.JTextField jTextFieldObstructive
private javax.swing.JTextField jTextFieldOccasional
private javax.swing.JTextField jTextFieldParticipant
private javax.swing.JTextField jTextFieldQuite
private javax.swing.JTextField jTextFieldTangent
private void performSimulation()
private void createAgents()
private void showResults()
private int readIterations()
private int readSimulations()
private double readSpeed()
public void initOtherComponents()
public void performSeveralSimulations()
public void updateFinishedSimulation()
updateFinishedSimulation
in interface ObserverAnimation
public void calculateSummary()
public void showSummary()
public void saveSeveralSimulations(java.io.PrintStream out)
public void saveJTable(javax.swing.JTable jtable, java.io.PrintStream out, int numRows)
jtable
- The JTable of the GUI that will be savedout
- The PrintStream in which the content of the table will be printed.numRows
- The number of rows that will be printedpublic void saveInputParameters(java.io.PrintStream out)
public void changeSizeJTableResults(int numRows)
numRows
- Number of Rowspublic void clearJTableSummary()
private void initComponents()
private void jTextFieldQuiteActionPerformed(java.awt.event.ActionEvent evt)
private void jTextFieldParticipantActionPerformed(java.awt.event.ActionEvent evt)
private void jTextFieldTangentActionPerformed(java.awt.event.ActionEvent evt)
private void jTextFieldJokerActionPerformed(java.awt.event.ActionEvent evt)
private void jTextFieldIterationsActionPerformed(java.awt.event.ActionEvent evt)
private void runSimulationActionPerformed(java.awt.event.ActionEvent evt)
evt
- private void jTextFieldObstructiveActionPerformed(java.awt.event.ActionEvent evt)
private void jTextFieldOccasionalActionPerformed(java.awt.event.ActionEvent evt)
private void jButtonSaveResultsActionPerformed(java.awt.event.ActionEvent evt)
private void jTextFieldNumSimulationsActionPerformed(java.awt.event.ActionEvent evt)
private void jComboBoxSpeedActionPerformed(java.awt.event.ActionEvent evt)
public static void main(java.lang.String[] args)
args
- the command line arguments