Active object: Difference between revisions

Content added Content deleted
Line 1,015: Line 1,015:


/**
/**
* Integrates input function f over time
* Integrates input function K over time
* s + (f(t1) + f(t0)) * (t1 - t0) / 2
* S + (K(t1) + K(t0)) * (t1 - t0) / 2
*
*
*
*
Line 1,025: Line 1,025:
private double s, lastS;
private double s, lastS;
private long t0, t1;
private long t0, t1;
private Thread thread;
private volatile boolean run;
private volatile boolean run;


Line 1,034: Line 1,033:
setInput(input);
setInput(input);
run = true;
run = true;
thread = new Thread(() -> {
new Thread(() -> {
while (run) {
while (run) {
try {
try {
Line 1,044: Line 1,043:
}
}
}
}
});
}).start();
thread.start();
}
}