// ======================================================
// Thermodynamics package in java
// wetairModel class to calculate properties of air water mixture
// requires by user interface wetairTable(JApplet)
// Dr. Turhan Coban
// University of Nebrasca
// Mechanical Engineering, N104 WSEC, Lincoln NE 68588-0656
// phone :
// email : MCOBAN2@netscape.net
//         MCOBAN2@unl.edu
// File Name   : wetairModel.java
// requires    : steam.java, Gas1.java, Atom.java, wetair.java
// =====================================================
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;

class wetairModel extends AbstractTableModel
{
  Object[][] veri;
  String[] baslik={"Property ","Value ","Units"};
  wetair st;
  public wetairModel(String unit,String s,double v1,double v2,double P)
  {
  st=new wetair();
  st.setUnit(unit);
  veri=st.toString1(s,v1,v2,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 String readName()
  {
  String name="";
  for(int i=0;i<veri.length;i++)
    {
	    name+=veri[i][0]+" ";
     } 
  return name;
  }
  public String readValue()
  {
  String value="";
    for(int i=0;i<veri.length;i++)
    value+=veri[i][1]+"              ";
  return value;
  }
  public String readUnit()
  {
  String unit="";
    for(int i=0;i<veri.length;i++)
    unit+=veri[i][2];
  return unit;  
  }    
  public void setValues(String unit,String s,double v1,double v2,double P)
  {
  st.setUnit(unit);
  veri=st.toString1(s,v1,v2,P);
  }

  public boolean isCellEditable(int row, int col) {return true;}
  

}


