simulation
Class SimulationGUI

java.lang.Object
  extended bysimulation.SimulationGUI

public class SimulationGUI
extends java.lang.Object


Field Summary
private  AlgorithmInvoker algoInv
           
 int borderRoom
          borderRoom keeps track of how much extra room you want to have for moving around things on-screen, beyond what is large enough for the hosts.
private  org.eclipse.swt.widgets.Button btnBack
           
private  org.eclipse.swt.widgets.Button btnBiasedStock
           
private  org.eclipse.swt.widgets.Button btnDecentralized
           
private  org.eclipse.swt.widgets.Button btnEnableCentralHost
           
private  org.eclipse.swt.widgets.Button btnExact
           
private  org.eclipse.swt.widgets.Button btnFixToHost
           
private  org.eclipse.swt.widgets.Button btnGenerate
           
private  org.eclipse.swt.widgets.Button btnGreedyApprox
           
private  org.eclipse.swt.widgets.Button btnMapNotOnSame
           
private  org.eclipse.swt.widgets.Button btnMapSame
           
private  org.eclipse.swt.widgets.Button btnModifyLevelOfDisconnect
           
private  org.eclipse.swt.widgets.Button btnUnbiasedStoch
           
private  org.eclipse.swt.widgets.Button btnUseMapping
           
private  boolean centralizedEnabled
           
private  org.eclipse.swt.widgets.Combo cmbAlgoAction
           
private  org.eclipse.swt.widgets.Table colocTable
           
private  org.eclipse.swt.widgets.Table compsTable
           
private  org.eclipse.swt.custom.TableCursor compsTableCursor
           
private  org.eclipse.swt.custom.ControlEditor compsTableEditor
           
private  org.eclipse.swt.widgets.Table compsTableES
           
private  org.eclipse.swt.custom.TableCursor compsTableESCursor
           
private  org.eclipse.swt.custom.ControlEditor compsTableESEditor
           
private  org.eclipse.draw2d.Figure contents
           
private  org.eclipse.swt.widgets.Shell controlShell
           
private  org.eclipse.swt.widgets.Display d
           
 Generator gen
           
private  org.eclipse.swt.widgets.Group grColoc
           
private  org.eclipse.swt.widgets.Group grComps
           
private  org.eclipse.swt.widgets.Group grHosts
           
private  org.eclipse.swt.widgets.Group grLoc
           
private  org.eclipse.swt.widgets.Table hostsTable
           
private  org.eclipse.swt.widgets.Table hostsTableBW
           
private  org.eclipse.swt.custom.TableCursor hostsTableBWCursor
           
private  org.eclipse.swt.custom.ControlEditor hostsTableBWEditor
           
private  org.eclipse.swt.custom.TableCursor hostsTableCursor
           
private  org.eclipse.swt.custom.ControlEditor hostsTableEditor
           
private  org.eclipse.swt.widgets.Label lblAvailability
           
private  org.eclipse.swt.widgets.List listComps
           
private  org.eclipse.swt.widgets.List listHosts
           
private  org.eclipse.swt.widgets.Table locTable
           
private  org.eclipse.draw2d.LightweightSystem lws
           
private  boolean mappingUsed
           
private  int numComps
           
private  int numHosts
           
private  int numIt
           
private  int numLoops
           
private  org.eclipse.draw2d.IFigure panel
           
private  org.eclipse.swt.widgets.Table resultsTable
           
private  org.eclipse.draw2d.ScrollPane scrollpane
           
private  SelectionDetailFigure sdf
           
private  SimulationGUI sg
           
private  org.eclipse.swt.widgets.Text txtDecNumIt
           
private  org.eclipse.swt.widgets.Text txtHostDisconnect
           
private  org.eclipse.swt.widgets.Text txtLevelAwareness
           
private  org.eclipse.swt.widgets.Text txtMaxBW
           
private  org.eclipse.swt.widgets.Text txtMaxBWCH
           
private  org.eclipse.swt.widgets.Text txtMaxCompFreq
           
private  org.eclipse.swt.widgets.Text txtMaxCompMem
           
private  org.eclipse.swt.widgets.Text txtMaxES
           
private  org.eclipse.swt.widgets.Text txtMaxHostMem
           
private  org.eclipse.swt.widgets.Text txtMaxHostRel
           
private  org.eclipse.swt.widgets.Text txtMaxRelCH
           
private  org.eclipse.swt.widgets.Text txtMinBW
           
private  org.eclipse.swt.widgets.Text txtMinBWCH
           
private  org.eclipse.swt.widgets.Text txtMinCompFreq
           
private  org.eclipse.swt.widgets.Text txtMinCompMem
           
private  org.eclipse.swt.widgets.Text txtMinES
           
private  org.eclipse.swt.widgets.Text txtMinHostMem
           
private  org.eclipse.swt.widgets.Text txtMinHostRel
           
private  org.eclipse.swt.widgets.Text txtMinRelCH
           
private  org.eclipse.swt.widgets.Text txtNumBench
           
private  org.eclipse.swt.widgets.Text txtNumComps
           
private  org.eclipse.swt.widgets.Text txtNumHosts
           
private  org.eclipse.swt.widgets.Text txtNumIt
           
private  org.eclipse.swt.widgets.Shell viewShell
           
 
Constructor Summary
SimulationGUI()
           
SimulationGUI(boolean test)
           
 
Method Summary
private  void addChildControls()
           
private  void btnBackPressed()
           
private  void btnBenchmarkPressed()
           
private  void btnClusteredPressed()
           
private  void btnEnableCentralHostClicked()
           
private  void btnFixToHostClicked()
           
private  void btnMapNotOnSameClicked()
           
private  void btnMapSameClicked()
           
private  void btnModifyLevelOfDisconnectClicked()
           
private  void buttonBiasedStockPressed()
           
private  void buttonDecentralizedPressed()
           
private  void buttonExactPressed()
           
private  void buttonGreedyApproxPressed()
           
private  void buttonUnbiasedStochPressed()
           
 void comDoubleClicked(int id)
          When this method is called, a new window is opened up to display the details of the component with the given id.
 void componentClicked(int id)
          When ComponentClicked is passed the id of a component, it tells the SelectionDetailFigure to display its details on-screen.
 void createC2CLink(int componentId1, int componentId2, double reliability, double bandwidth)
          This method creates a link between two components.
 void createComponent(int componentId, int hostId, double memory)
          This method creates a new component in a particular host.
 void createH2HLink(int HostId1, int HostId2, double reliability, double bandwidth)
          This method creates a new link between two hosts.
 void createHost(int Hostid, double memory)
          This method creates a new host and places it at the next appropriate location.
 void createHost(int Hostid, double memory, int x_pos, int y_pos)
          This method creates a new host and places is exactly where you tell it to be.
private  void displayResult(AlgorithmResult result, int algoID)
           
private  void fillTables()
           
private  void generate()
           
 void hostClicked(int id)
          When HostClicked is passed the id of a host, it tells the SelectionDetailFigure to display its details on-screen.
 void hostDoubleClicked(int id)
          When this method is called, a new window is opened up to display the details of the host with the given id.
private  void instantiateSimulationGUI()
           
static void main(java.lang.String[] args)
           
 void moveComponent(int com_id, int new_host_id)
          This method moves the component with the given ID to a new host.
 void removeC2CLink(int componentId1, int componentId2)
          This method removes a link between two components based on the IDs of those components.
 void removeComponent(int componentId)
           
 void removeH2HLink(int HostId1, int HostId2)
          This function removes a H2HLinkFigure between two hosts.
 void removeHost(int HostId)
          This method removes the Host with the given ID from the graph.
private  void resizeComps(double rate)
           
private  void resizeHosts(double rate)
           
 void run()
          Run() updates the display until the program has exited.
 void setC2CLinkQuality(int com1_id, int com2_id, double quality)
          This method sets the quality of a Component to Component link with the given quality.
 void setComponentQuality(int com_id, double quality)
          This method sets the quality of the component.
 void setH2HLinkQuality(int host1_id, int host2_id, double quality)
          This method sets the quality for a Host to Host link with the given quality.
 void setHostQuality(int host_id, double quality)
          This method sets the quality of the host.
 void test_function()
           
 void testRun()
          Another testing method, along with SimulationGUI(bool),Main() and test_funtion()
private  void useMapping()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

borderRoom

public int borderRoom
borderRoom keeps track of how much extra room you want to have for moving around things on-screen, beyond what is large enough for the hosts.


viewShell

private org.eclipse.swt.widgets.Shell viewShell

controlShell

private org.eclipse.swt.widgets.Shell controlShell

d

private org.eclipse.swt.widgets.Display d

sg

private SimulationGUI sg

lws

private org.eclipse.draw2d.LightweightSystem lws

contents

private org.eclipse.draw2d.Figure contents

sdf

private SelectionDetailFigure sdf

panel

private org.eclipse.draw2d.IFigure panel

scrollpane

private org.eclipse.draw2d.ScrollPane scrollpane

hostsTable

private org.eclipse.swt.widgets.Table hostsTable

compsTable

private org.eclipse.swt.widgets.Table compsTable

resultsTable

private org.eclipse.swt.widgets.Table resultsTable

locTable

private org.eclipse.swt.widgets.Table locTable

colocTable

private org.eclipse.swt.widgets.Table colocTable

hostsTableBW

private org.eclipse.swt.widgets.Table hostsTableBW

compsTableES

private org.eclipse.swt.widgets.Table compsTableES

hostsTableCursor

private org.eclipse.swt.custom.TableCursor hostsTableCursor

compsTableCursor

private org.eclipse.swt.custom.TableCursor compsTableCursor

hostsTableBWCursor

private org.eclipse.swt.custom.TableCursor hostsTableBWCursor

compsTableESCursor

private org.eclipse.swt.custom.TableCursor compsTableESCursor

hostsTableEditor

private org.eclipse.swt.custom.ControlEditor hostsTableEditor

compsTableEditor

private org.eclipse.swt.custom.ControlEditor compsTableEditor

hostsTableBWEditor

private org.eclipse.swt.custom.ControlEditor hostsTableBWEditor

compsTableESEditor

private org.eclipse.swt.custom.ControlEditor compsTableESEditor

txtNumComps

private org.eclipse.swt.widgets.Text txtNumComps

txtNumHosts

private org.eclipse.swt.widgets.Text txtNumHosts

txtMaxCompMem

private org.eclipse.swt.widgets.Text txtMaxCompMem

txtMinCompMem

private org.eclipse.swt.widgets.Text txtMinCompMem

txtMaxHostMem

private org.eclipse.swt.widgets.Text txtMaxHostMem

txtMinHostMem

private org.eclipse.swt.widgets.Text txtMinHostMem

txtMaxCompFreq

private org.eclipse.swt.widgets.Text txtMaxCompFreq

txtMinCompFreq

private org.eclipse.swt.widgets.Text txtMinCompFreq

txtMaxHostRel

private org.eclipse.swt.widgets.Text txtMaxHostRel

txtMinHostRel

private org.eclipse.swt.widgets.Text txtMinHostRel

txtNumIt

private org.eclipse.swt.widgets.Text txtNumIt

txtMinES

private org.eclipse.swt.widgets.Text txtMinES

txtMaxES

private org.eclipse.swt.widgets.Text txtMaxES

txtMinBW

private org.eclipse.swt.widgets.Text txtMinBW

txtMaxBW

private org.eclipse.swt.widgets.Text txtMaxBW

txtMinBWCH

private org.eclipse.swt.widgets.Text txtMinBWCH

txtMaxBWCH

private org.eclipse.swt.widgets.Text txtMaxBWCH

txtMinRelCH

private org.eclipse.swt.widgets.Text txtMinRelCH

txtMaxRelCH

private org.eclipse.swt.widgets.Text txtMaxRelCH

txtNumBench

private org.eclipse.swt.widgets.Text txtNumBench

txtHostDisconnect

private org.eclipse.swt.widgets.Text txtHostDisconnect

txtLevelAwareness

private org.eclipse.swt.widgets.Text txtLevelAwareness

txtDecNumIt

private org.eclipse.swt.widgets.Text txtDecNumIt

btnGenerate

private org.eclipse.swt.widgets.Button btnGenerate

btnExact

private org.eclipse.swt.widgets.Button btnExact

btnUnbiasedStoch

private org.eclipse.swt.widgets.Button btnUnbiasedStoch

btnBiasedStock

private org.eclipse.swt.widgets.Button btnBiasedStock

btnGreedyApprox

private org.eclipse.swt.widgets.Button btnGreedyApprox

btnDecentralized

private org.eclipse.swt.widgets.Button btnDecentralized

btnUseMapping

private org.eclipse.swt.widgets.Button btnUseMapping

btnMapSame

private org.eclipse.swt.widgets.Button btnMapSame

btnMapNotOnSame

private org.eclipse.swt.widgets.Button btnMapNotOnSame

btnFixToHost

private org.eclipse.swt.widgets.Button btnFixToHost

btnBack

private org.eclipse.swt.widgets.Button btnBack

btnEnableCentralHost

private org.eclipse.swt.widgets.Button btnEnableCentralHost

btnModifyLevelOfDisconnect

private org.eclipse.swt.widgets.Button btnModifyLevelOfDisconnect

grHosts

private org.eclipse.swt.widgets.Group grHosts

grComps

private org.eclipse.swt.widgets.Group grComps

grLoc

private org.eclipse.swt.widgets.Group grLoc

grColoc

private org.eclipse.swt.widgets.Group grColoc

listHosts

private org.eclipse.swt.widgets.List listHosts

listComps

private org.eclipse.swt.widgets.List listComps

cmbAlgoAction

private org.eclipse.swt.widgets.Combo cmbAlgoAction

algoInv

private AlgorithmInvoker algoInv

lblAvailability

private org.eclipse.swt.widgets.Label lblAvailability

gen

public Generator gen

numComps

private int numComps

numHosts

private int numHosts

numIt

private int numIt

numLoops

private int numLoops

mappingUsed

private boolean mappingUsed

centralizedEnabled

private boolean centralizedEnabled
Constructor Detail

SimulationGUI

public SimulationGUI()

SimulationGUI

public SimulationGUI(boolean test)
Method Detail

moveComponent

public void moveComponent(int com_id,
                          int new_host_id)
This method moves the component with the given ID to a new host. ( The implementation is simple. It does this by calling the removeCom method and then the addCom with all the same parameters of the original component. ) It does nothing if either host or com does not exist.

Parameters:
com_id - The id of the component you want to move.
new_host_id - The id of the host that you want to move this component to.

addChildControls

private void addChildControls()

hostClicked

public void hostClicked(int id)
When HostClicked is passed the id of a host, it tells the SelectionDetailFigure to display its details on-screen.

Parameters:
id - The id of the Host whose details should be displayed.

hostDoubleClicked

public void hostDoubleClicked(int id)
When this method is called, a new window is opened up to display the details of the host with the given id.

Parameters:
id - The id of the host whose details should be displayed.

comDoubleClicked

public void comDoubleClicked(int id)
When this method is called, a new window is opened up to display the details of the component with the given id.

Parameters:
id - The id of the component whose details should be displayed.

componentClicked

public void componentClicked(int id)
When ComponentClicked is passed the id of a component, it tells the SelectionDetailFigure to display its details on-screen.

Parameters:
id - The id of the Component whose details should be displayed.

test_function

public void test_function()

main

public static void main(java.lang.String[] args)

createHost

public void createHost(int Hostid,
                       double memory)
This method creates a new host and places it at the next appropriate location. Use this method if you don't need to specify the locations of the hosts and you want them placed automatically. Otherwise, use the other version of createHost. It's probably best not to mix and match these two functions.

Parameters:
Hostid - The ID of the host you are creating.
memory - The amount of memory the host that you are creating has.

createHost

public void createHost(int Hostid,
                       double memory,
                       int x_pos,
                       int y_pos)
This method creates a new host and places is exactly where you tell it to be. Use this method when you want to control exactly where you hosts will start. If you don't care where they start, use the other overloaded version of this method. It's probably best not to mix and math the two, however.

Parameters:
Hostid - The ID of the host you are creating.
memory - The amount of memory that the host has.
x_pos - The X coordinate of the position where this host will be placed.
y_pos - The Y coordinate of the position where this host will be placed.

createComponent

public void createComponent(int componentId,
                            int hostId,
                            double memory)
This method creates a new component in a particular host.

Parameters:
componentId -
hostId -
memory -

createC2CLink

public void createC2CLink(int componentId1,
                          int componentId2,
                          double reliability,
                          double bandwidth)
This method creates a link between two components. It does not matter whether the two components are on the same host or not. This method takes that into account and will create a H2H link if components from different hosts are meant to be connected.

Parameters:
componentId1 - The ID of the first component.
componentId2 - The ID of the seccond component.
reliability - The reliability of the link between the two components.
bandwidth - The bandwidth of the link between the two components.

createH2HLink

public void createH2HLink(int HostId1,
                          int HostId2,
                          double reliability,
                          double bandwidth)
This method creates a new link between two hosts. The two hosts are determined by the the Host IDs passed. The link is only created if one does not already exist.

Parameters:
HostId1 - The ID of the first host.
HostId2 - The ID of the second host.
reliability - The reliability that this link will have.
bandwidth - The bandwith of this link.

setH2HLinkQuality

public void setH2HLinkQuality(int host1_id,
                              int host2_id,
                              double quality)
This method sets the quality for a Host to Host link with the given quality. You must give the ids of the two hosts that the link connects. If the link does not exist, nothing happens.

Parameters:
host1_id - The id of the first host of the H2HLink.
host2_id - The id of the seccond host of the H2HLink.
quality - The quality to set this link to.

setC2CLinkQuality

public void setC2CLinkQuality(int com1_id,
                              int com2_id,
                              double quality)
This method sets the quality of a Component to Component link with the given quality. You must give the ids of the two hosts that the link connects. If the link does not exist, nothing happens.

Parameters:
com1_id - The id of the first component in the C2CLink.
com2_id - The id of the seccond component in the C2CLink.
quality - The quality to set this link to.

setHostQuality

public void setHostQuality(int host_id,
                           double quality)
This method sets the quality of the host. If the host does not exist, nothing happens.

Parameters:
host_id - The id of the host whose quality you want to set.
quality - The quality to set to this host.

setComponentQuality

public void setComponentQuality(int com_id,
                                double quality)
This method sets the quality of the component. If the component does not exist, nothing happens.

Parameters:
com_id - The id of the component whose quality you want to set.
quality - The quality to set to this component.

removeHost

public void removeHost(int HostId)
This method removes the Host with the given ID from the graph.

Parameters:
HostId - The ID of the Host to be removed.

removeH2HLink

public void removeH2HLink(int HostId1,
                          int HostId2)
This function removes a H2HLinkFigure between two hosts. At this point, the H2HLink must actually exist or this function could have problems. It removes the Link based on the IDs of the hosts the share the link.

Parameters:
HostId1 - The ID of the first host.
HostId2 - The ID of the second host.

removeComponent

public void removeComponent(int componentId)

removeC2CLink

public void removeC2CLink(int componentId1,
                          int componentId2)
This method removes a link between two components based on the IDs of those components.

Parameters:
componentId1 - The ID of the first component.
componentId2 - The ID of the second component.

run

public void run()
Run() updates the display until the program has exited.


testRun

public void testRun()
Another testing method, along with SimulationGUI(bool),Main() and test_funtion()


generate

private void generate()

useMapping

private void useMapping()

instantiateSimulationGUI

private void instantiateSimulationGUI()

fillTables

private void fillTables()

btnModifyLevelOfDisconnectClicked

private void btnModifyLevelOfDisconnectClicked()

buttonExactPressed

private void buttonExactPressed()

buttonUnbiasedStochPressed

private void buttonUnbiasedStochPressed()

buttonBiasedStockPressed

private void buttonBiasedStockPressed()

buttonGreedyApproxPressed

private void buttonGreedyApproxPressed()

buttonDecentralizedPressed

private void buttonDecentralizedPressed()

btnBenchmarkPressed

private void btnBenchmarkPressed()

btnClusteredPressed

private void btnClusteredPressed()

btnBackPressed

private void btnBackPressed()

displayResult

private void displayResult(AlgorithmResult result,
                           int algoID)

btnMapSameClicked

private void btnMapSameClicked()

btnMapNotOnSameClicked

private void btnMapNotOnSameClicked()

btnFixToHostClicked

private void btnFixToHostClicked()

btnEnableCentralHostClicked

private void btnEnableCentralHostClicked()

resizeComps

private void resizeComps(double rate)

resizeHosts

private void resizeHosts(double rate)