comparison src/samer/units/EnergyOperator.java @ 0:bf79fb79ee13

Initial Mercurial check in.
author samer
date Tue, 17 Jan 2012 17:50:20 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:bf79fb79ee13
1 /*
2 * Copyright (c) 2000, Samer Abdallah, King's College London.
3 * All rights reserved.
4 *
5 * This software is provided AS iS and WITHOUT ANY WARRANTY;
6 * without even the implied warranty of MERCHANTABILITY or
7 * FITNESS FOR A PARTICULAR PURPOSE.
8 */
9
10 package samer.units;
11 import samer.core.*;
12 import samer.maths.*;
13
14 public class EnergyOperator implements Filter
15 {
16 double u1=0, u2=0; // previous two values
17
18 public EnergyOperator() {}
19
20 public void dispose() {}
21
22 public double filter( double u0)
23 {
24 double y=u1*u1 - u0*u2;
25 u2=u1;
26 u1=u0;
27
28 return y;
29 }
30 }
31