Added code for StatisticsCalculator, Periode.. etc

Added a lot of code. Currently not functioning for Periode is acting
strange.
Not tested...
This commit is contained in:
Kenneth van Ewijk
2014-10-19 14:38:43 +02:00
parent cbd4ef9077
commit ab4df98479
7 changed files with 363 additions and 84 deletions
+48
View File
@@ -0,0 +1,48 @@
import java.util.ArrayList;
public class LangsteZomerPeriode extends Grootheid{
private ArrayList<Double> list;
private Periode zomerPeriode;
//constructor
public LangsteZomerPeriode(Measurement measurement1, ArrayList<Measurement> measurement2, Periode totalePeriode){
list = new ArrayList<Double>();
zomerPeriode = new Periode();
updateRecent(measurement1);
update24Hour(measurement2);
}
public void updateRecent(Measurement measurement1){
setCurrent(measurement1.getOutsideTemp());
}
public void update24Hour(ArrayList<Measurement> measurement2){
createList(measurement2);
calculateMaxMinAvg(list);
int[] index = StatisticsCalculator.langsteZomersePeriode(list);
zomerPeriode = Calculator.timeStampToPeriode( measurement2.get(index[0]).getDateStamp(), measurement2.get(index[1]).getDateStamp());
}
public void display(){
GUIboard.writePageToMatrix("Langste zomerse periode", zomerPeriode.toString(), "");
}
public void displayGraph()
{
display();
}
private void createList(ArrayList<Measurement> measurement2)
{
if(!list.isEmpty())
{
list.clear();
}
for(Measurement ms : measurement2)
{
list.add(ms.getOutsideTemp());
}
}
}