47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
|
|
import java.util.ArrayList;
|
|
|
|
public class InsideHum extends Grootheid{
|
|
public ArrayList<Double> list;
|
|
|
|
//constructor
|
|
public InsideHum(Measurement measurement1, ArrayList<Measurement> measurement2){
|
|
list = new ArrayList<Double>();
|
|
updateRecent(measurement1);
|
|
updatePeriod(measurement2);
|
|
}
|
|
|
|
|
|
public void updateRecent(Measurement measurement1){
|
|
setCurrent(measurement1.getInsideHum());
|
|
}
|
|
public void updatePeriod(ArrayList<Measurement> measurement2){
|
|
createList(measurement2);
|
|
calculateMaxMin(list);
|
|
setAvg(StatisticsCalculator.avg(list));
|
|
}
|
|
|
|
public void display(){
|
|
super.display();
|
|
GUIboard.writePageToMatrix("Luchtv. Binnen", "Gemiddelde: " + getAvg(), "");
|
|
}
|
|
|
|
public void displayGraph()
|
|
{
|
|
GUIboard.writeGraphToMatrix(list, getMin(), getMax());
|
|
}
|
|
|
|
private void createList(ArrayList<Measurement> measurement2)
|
|
{
|
|
if(!list.isEmpty())
|
|
{
|
|
list.clear();
|
|
}
|
|
|
|
for(Measurement ms : measurement2)
|
|
{
|
|
list.add(ms.getInsideHum());
|
|
}
|
|
}
|
|
}
|