瀏覽代碼

Speed optimalisation and fixed the damn thing!

jancoow 11 年之前
父節點
當前提交
6e2719bbc8
共有 1 個文件被更改,包括 18 次插入3 次删除
  1. 18 3
      Weerstation.java

+ 18 - 3
Weerstation.java

@@ -1,10 +1,13 @@
+package weerstation;
  
  
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
 import java.util.List;
 import java.util.List;
 import java.util.Timer;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.TimerTask;
-import java.util.Calendar;
+
 
 
 public class Weerstation {
 public class Weerstation {
     WeerstationConnector weerstation1;
     WeerstationConnector weerstation1;
@@ -76,7 +79,7 @@ public class Weerstation {
         wait = true;
         wait = true;
         graph = false;
         graph = false;
         Timer timer = new Timer();
         Timer timer = new Timer();
-
+        checkData();
         //All the different screen classes
         //All the different screen classes
     
     
         final List<Grootheid> lstScreens = new ArrayList<Grootheid>();
         final List<Grootheid> lstScreens = new ArrayList<Grootheid>();
@@ -153,7 +156,7 @@ public class Weerstation {
             public void run() {
             public void run() {
                 meting2 = weerstation1.getAllMeasurementsLast24h();
                 meting2 = weerstation1.getAllMeasurementsLast24h();
                 for(Grootheid obj : lstScreens){
                 for(Grootheid obj : lstScreens){
-                    obj.update24Hour(meting2);
+                    obj.updatePeriod(meting2);
                 }
                 }
             }
             }
         }, 10*60*1000, 10*60*1000);
         }, 10*60*1000, 10*60*1000);
@@ -260,4 +263,16 @@ public class Weerstation {
     {
     {
         starter.cancel();
         starter.cancel();
     }
     }
+    
+    public void checkData(){
+    	Iterator<Measurement> it = meting2.iterator();
+        while( it.hasNext() )
+        {
+            Measurement m = it.next();
+            if(m.getRawOutsideTemp() >= 30000)
+            {
+                it.remove();
+            }
+        }
+    }
 }
 }