Added support for graphs
Also added small bits of code to center the name on the matrix display.
This commit is contained in:
+21
-9
@@ -1,9 +1,11 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WindChill extends Grootheid{
|
||||
public ArrayList<Double> list;
|
||||
|
||||
//constructor
|
||||
public WindChill(Measurement measurement1, ArrayList<Measurement> measurement2){
|
||||
list = new ArrayList<Double>();
|
||||
updateRecent(measurement1);
|
||||
update24Hour(measurement2);
|
||||
}
|
||||
@@ -13,20 +15,30 @@ public class WindChill extends Grootheid{
|
||||
setCurrent(measurement1.getWindChill());
|
||||
}
|
||||
public void update24Hour(ArrayList<Measurement> measurement2){
|
||||
|
||||
ArrayList<Double> list = new ArrayList<Double>();
|
||||
|
||||
for(Measurement ms : measurement2)
|
||||
{
|
||||
list.add(ms.getWindChill());
|
||||
}
|
||||
|
||||
createList(measurement2);
|
||||
calculateMaxMinAvg(list);
|
||||
}
|
||||
|
||||
public void display(){
|
||||
super.display();
|
||||
GUIboard.writePageToMatrix("Gevoelstemperatuur", "Gemiddelde: " + getAvg(), "");
|
||||
GUIboard.writePageToMatrix("Gevoelstemp", "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.getWindChill());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user