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:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user