From 6e2719bbc8cd23da75096ffa0f5f118938c12c0f Mon Sep 17 00:00:00 2001 From: jancoow Date: Mon, 20 Oct 2014 21:16:49 +0200 Subject: [PATCH] Speed optimalisation and fixed the damn thing! --- Weerstation.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Weerstation.java b/Weerstation.java index ae951fc..5d14508 100644 --- a/Weerstation.java +++ b/Weerstation.java @@ -1,10 +1,13 @@ +package weerstation; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Iterator; import java.util.List; import java.util.Timer; import java.util.TimerTask; -import java.util.Calendar; + public class Weerstation { WeerstationConnector weerstation1; @@ -76,7 +79,7 @@ public class Weerstation { wait = true; graph = false; Timer timer = new Timer(); - + checkData(); //All the different screen classes final List lstScreens = new ArrayList(); @@ -153,7 +156,7 @@ public class Weerstation { public void run() { meting2 = weerstation1.getAllMeasurementsLast24h(); for(Grootheid obj : lstScreens){ - obj.update24Hour(meting2); + obj.updatePeriod(meting2); } } }, 10*60*1000, 10*60*1000); @@ -260,4 +263,16 @@ public class Weerstation { { starter.cancel(); } + + public void checkData(){ + Iterator it = meting2.iterator(); + while( it.hasNext() ) + { + Measurement m = it.next(); + if(m.getRawOutsideTemp() >= 30000) + { + it.remove(); + } + } + } }