Grootheid.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package weerstation1;
  2. import java.util.ArrayList;
  3. public class Grootheid
  4. {
  5. // instance variables - replace the example below with your own
  6. private double avg;
  7. private double max;
  8. private double min;
  9. private double mode;
  10. private double median;
  11. private double deviation;
  12. private double current;
  13. //constructor
  14. public Grootheid(){
  15. avg = 0;
  16. max = 0;
  17. min = 0;
  18. current = 0;
  19. }
  20. //getters & setters
  21. public double getCurrent() {
  22. return current;
  23. }
  24. public void setCurrent(double current) {
  25. this.current = current;
  26. }
  27. public double getMax() {
  28. return max;
  29. }
  30. public void setMax(double max) {
  31. this.max= max;
  32. }
  33. public double getMin() {
  34. return min;
  35. }
  36. public void setMin(double min) {
  37. this.min = min;
  38. }
  39. public double getAvg() {
  40. return avg;
  41. }
  42. public void setAvg(double avg) {
  43. this.avg = avg;
  44. }
  45. public double getMode() {
  46. return mode;
  47. }
  48. public void setMode(double mode) {
  49. this.mode = mode;
  50. }
  51. public double getMedian() {
  52. return median;
  53. }
  54. public void setMedian(double median) {
  55. this.median = median;
  56. }
  57. public double getDeviation() {
  58. return deviation;
  59. }
  60. public void setDeviation(double deviation) {
  61. this.deviation = deviation;
  62. }
  63. //Methods
  64. public void calculateMaxMinAvg(ArrayList<Double> array){
  65. setMax( StatisticsCalculator.max(array) );
  66. setMin( StatisticsCalculator.min(array) );
  67. setAvg( StatisticsCalculator.avg(array) );
  68. setMedian( StatisticsCalculator.median(array) );
  69. setMode( StatisticsCalculator.modus(array) );
  70. setDeviation( StatisticsCalculator.afwijking(array) );
  71. }
  72. public void updateRecent(Measurement measurement1){
  73. }
  74. public void update24Hour(ArrayList<Measurement> measurement2){
  75. }
  76. public void display(){
  77. GUIboard.writeUpperDigits(getCurrent());
  78. GUIboard.writeLeftDigits(getMax());
  79. GUIboard.writeRightDigits(getMin());
  80. }
  81. public void displayGraph()
  82. {
  83. }
  84. }