samer@0: /* samer@0: * Copyright (c) 2000, Samer Abdallah, King's College London. samer@0: * All rights reserved. samer@0: * samer@0: * This software is provided AS iS and WITHOUT ANY WARRANTY; samer@0: * without even the implied warranty of MERCHANTABILITY or samer@0: * FITNESS FOR A PARTICULAR PURPOSE. samer@0: */ samer@0: samer@0: package samer.units; samer@0: import samer.core.*; samer@0: import samer.maths.*; samer@0: samer@0: public class EnergyOperator implements Filter samer@0: { samer@0: double u1=0, u2=0; // previous two values samer@0: samer@0: public EnergyOperator() {} samer@0: samer@0: public void dispose() {} samer@0: samer@0: public double filter( double u0) samer@0: { samer@0: double y=u1*u1 - u0*u2; samer@0: u2=u1; samer@0: u1=u0; samer@0: samer@0: return y; samer@0: } samer@0: } samer@0: