-
Notifications
You must be signed in to change notification settings - Fork 0
/
SensorDataProvider.pde
60 lines (52 loc) · 1.29 KB
/
SensorDataProvider.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class SensorDataProvider
{
private Table dataTable;
private String filePath;
public TableRow row;
//Initializes the new SensorDataProvidor
//file:String of the name of the data table to be accessed.
SensorDataProvider (String file)
{
filePath=file;
dataTable=loadTable(filePath, "header");
}
//Increments the index of the data table and sets the row to
//the row with the index of currrentIndex
public void readNext()
{
if(currentIndex<dataTable.getRowCount()-1)
{
row=dataTable.getRow(currentIndex);
}
}
//Returns Time value of current row
public int readTime()
{
return row.getInt("Time");
}
//Returns RPM value of current row
public int readRPM()
{
return row.getInt("RPM");
}
//Returns Fuel Level value of current row
public float readFuel()
{
return row.getFloat("Fuel Level");
}
//Returns Gear Ratio value of current row
public float readRatio()
{
return row.getFloat("Gear Ratio");
}
//Returns X value of current row
public float readX()
{
return row.getFloat("X");
}
//Returns Y value of current row
public float readY()
{
return row.getFloat("Y");
}
}