2014-07-26 01:34:58 +02:00
|
|
|
package org.hwo;
|
|
|
|
|
|
|
|
public class Smoother {
|
|
|
|
|
|
|
|
private int summe;
|
|
|
|
private int wert;
|
|
|
|
private int tn;
|
|
|
|
|
|
|
|
public Smoother()
|
|
|
|
{
|
|
|
|
setSumme(0);
|
|
|
|
setWert(0);
|
|
|
|
setTn(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int cycle(int value)
|
|
|
|
{
|
|
|
|
summe += value;
|
|
|
|
wert = summe / tn;
|
|
|
|
summe -= wert;
|
|
|
|
return wert;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getSumme() {
|
|
|
|
return summe;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSumme(int summe) {
|
|
|
|
this.summe = summe;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getWert() {
|
|
|
|
return wert;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setWert(int wert) {
|
2016-09-06 11:48:36 +02:00
|
|
|
this.setSumme( (wert * tn) - wert );
|
2014-07-26 01:34:58 +02:00
|
|
|
this.wert = wert;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getTn() {
|
|
|
|
return tn;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTn(int tn) {
|
|
|
|
this.tn = tn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|