using System;
using System.Data;
using System.Collections;
namespace simulator
{
///
/// DataTable subclass used as data source for bindesg with the datagrid used to show the program being simulated
///
///
public class MyTableModel : DataTable
{
String[] columnNames;
ArrayList data;
//===========================CONSTRUCTOR RECEIVING A DATA VECTOR AND A COLUMN NAME VECTOR==============
public MyTableModel(ArrayList data, String[] columnNames)
{
this.data=data;
this.columnNames=columnNames;
// creates table structure
for(int i=0;irow)
data.Insert(row,val);
if(Columns.Count==11 && Rows.Count > row)
{
DataRow r;
r=NewRow();
r[0]=((UserInstruction)val).numar;
r[1]=((UserInstruction)val).salt;
r[2]=((UserInstruction)val).micro;
r[3]=((UserInstruction)val).mux;
r[4]=((UserInstruction)val).dest;
r[5]=((UserInstruction)val).sursa;
r[6]=((UserInstruction)val).c;
r[7]=((UserInstruction)val).operatie;
r[8]=((UserInstruction)val).adresaA;
r[9]=((UserInstruction)val).adresaB;
r[10]=((UserInstruction)val).adresaD;
this.Rows.InsertAt(r,row);
}
}
//===========================REPLACE ROW==============================================
public void replaceRow(int row, Object val)
{
if(data.Count>row)
data[row]=val;
if(this.Columns.Count==11 && Rows.Count > row)
{
Rows[row][0]=((UserInstruction)val).numar;
Rows[row][1]=((UserInstruction)val).salt;
Rows[row][2]=((UserInstruction)val).micro;
Rows[row][3]=((UserInstruction)val).mux;
Rows[row][4]=((UserInstruction)val).dest;
Rows[row][5]=((UserInstruction)val).sursa;
Rows[row][6]=((UserInstruction)val).c;
Rows[row][7]=((UserInstruction)val).operatie;
Rows[row][8]=((UserInstruction)val).adresaA;
Rows[row][9]=((UserInstruction)val).adresaB;
Rows[row][10]=((UserInstruction)val).adresaD;
}
}
//===========================DELETE ROW===================================================
public void deleteRow(int row)
{
if(row