/*
* primitiveDB.java
*
* Created on 27. November 2006, 15:41
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package javaapplication5.db;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author kj09
*/
public class primitiveDB {
public ArrayList db;
/** Creates a new instance of primitiveDB */
public primitiveDB() {
db = new ArrayList();
}
public void add(int row, int col, String data){
//First we will check if a record with this id already exists:
if(db.size() > row && db.size() != 0){ //Yes, a record with this id already exists.
data_base_entry entry = (data_base_entry) db.get(row);
entry.add(col, data);
}else{ //No, we will make a full new entry.
data_base_entry entry = new data_base_entry(row);
entry.add(col, data);
db.add(row, entry);
}
}
public int getLastRow(){ //The LastRow of this db (ID)
return(db.size());
}
public int getLastCol(int row){
data_base_entry entry = (data_base_entry) db.get(row);
return(entry.getLastCol());
}
public data_base_entry getRow(int row){
return((data_base_entry) db.get(row));
}
public int recordno(){
return(db.size());
}
}