// ======================================================
// Thermodynamics package in java
// refModel class to calculate properties of refrigerants
// requires by user interface refTable(JApplet)
// Dr. Turhan Coban
// Ege University, ENgineering Department
// Mechanical Engineering, 
// phone :
// email : turhan.coban@ege.edu.tr
// File Name   : refTable.java
// requires    : ref.java, refTable.java
// =====================================================

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

class refModel extends AbstractTableModel
{
  Object[][] veri;
  String[] baslik={"Property ","Value ","Units"};
  ref re;

  public refModel(String r,String unit,String s,double v1,double v2)
  {
  re=new ref(r);	  
  re.setUnit(unit);
  veri=re.toString(s,v1,v2);
  }

  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(String r,String unit,String s,double v1,double v2)
  {
  re=new ref(r);
  re.setUnit(unit);
  veri=re.toString(s,v1,v2);
  }
  
  public boolean isCellEditable(int row, int col) {return true;}
}


