import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;

class GasModelMass extends AbstractTableModel
{
  Object[][] veri={
    {"Gas Formula                    : ","0","  "},
    {"M                              : ","0","kg/kg"},
    {"h, enthalpy                    : ","0","KJ/kg"},
    {"u, Internal energy             : ","0","KJ/kg"},
    {"v, Specific volume             : ","0","m^3/kg"},
    {"s, Entropy                     : ","0","KJ/kg K"},
    {"k, Thermal conductivity        : ","0","W/m K"},
    {"h+hf, enthalpy+formation enth. : ","0","KJ/kg"},
    {"Density                        : ","0","kg/m^3"},
    {"Cp                             : ","0"," KJ/kg K"},
    {"Cv                             : ","0","KJ/kg K"},
    {"Cp/Cv adiabatic constant       : ","0","  "},
    {"c speed of sound               : ","0","m/s"},
    {"Viscosity                      : ","0","N s/m^2"},
    {"Pr,Prandtl Number              : ","0","   "}};
  String[] baslik={"Property ","Value ","Units"};

  public GasModelMass(Gas g1,double TK,double P)
  {
  setValues(g1,TK,P);
  }

  public int getRowCount() {return veri.length;}
  public int getColumnCount() {return baslik.length;}
  public Object getValueAt(int satir,int sutun) {return veri[satir][sutun];}
  public String getColumnName(int c) {return baslik[c];}
  public void setValueAt(Object val, int row, int col)
  {
    veri[row][col] = val;
   }

  public void setValues(Gas g1,double T,double P)
  {
    double TK=T+273.0;
    setValueAt(g1.toString(),0,1);
    setValueAt((""+g1.M),1,1);
    setValueAt(Double.toString(g1.h(TK)/g1.M),2,1);
    setValueAt(Double.toString(g1.u(TK)/g1.M),3,1);
    setValueAt(Double.toString(g1.v(TK,P)/g1.M),4,1);
    setValueAt(Double.toString(g1.s(TK,P)/g1.M),5,1);
    setValueAt(Double.toString(g1.k(TK)),6,1);
    setValueAt(Double.toString(g1.ht(TK)),7,1);
    setValueAt(Double.toString(g1.M/g1.v(TK,P)),8,1);
    setValueAt(Double.toString(g1.Cp(TK)/g1.M),9,1);
    setValueAt(Double.toString(g1.Cv(TK)/g1.M),10,1);
    setValueAt(Double.toString(g1.gamma(TK)),11,1);
    setValueAt(Double.toString(g1.c(TK)),12,1);
    setValueAt(Double.toString(g1.vis(TK)),13,1);
    setValueAt(Double.toString(g1.Pr(TK)),14,1);
  }
  public boolean isCellEditable(int row, int col) {return true;}
}


