From fdb867aa1c0c1eaf18eb9d847b837c55afd313c4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 13 Oct 2014 15:34:37 +0200 Subject: [PATCH] DewPoint Toegevoegt --- DewPoint | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 DewPoint diff --git a/DewPoint b/DewPoint new file mode 100644 index 0000000..68c6b8f --- /dev/null +++ b/DewPoint @@ -0,0 +1,45 @@ +import java.util.ArrayList; + +public class DewPoint extends Grootheid +{ + public ArrayList list; + + //constructor + public DewPoint(Measurement measurement1, ArrayList measurement2){ + list = new ArrayList(); + updateRecent(measurement1); + update24Hour(measurement2); + } + + + public void updateRecent(Measurement measurement1){ + setCurrent(measurement1.getDewPoint()); + } + public void update24Hour(ArrayList measurement2){ + createList(measurement2); + calculateMaxMinAvg(list); + } + + public void display(){ + GUIboard.writeUpperDigits(current); + GUIboard.writePageToMatrix("Douwpunt", "Gemiddelde: " + getAvg(), ""); + } + + public void displayGraph() + { + GUIboard.writeGraphToMatrix(list, getMin(), getMax()); + } + + private void createList(ArrayList measurement2) + { + if(!list.isEmpty()) + { + list.clear(); + } + + for(Measurement ms : measurement2) + { + list.add(ms.getDewPoint()); + } + } +}