Filter Example (x = x + c)
import java.util.*; import java.awt.*; import sv.kernel.*;
public class CAddXFilter extends Filter {
public CAddXFilter()// output data set's dimension is 1 and 1 arg needs
super(Filter.ONED, 1); label = "Enter the constant c: ";
public Object performFilter() {
DataSet1D dataSet = (DataSet1D)sources.firstElement();
Vector timeDataVec = new Vector();
for (int i=0; i < dataSet.getnoOfTime(); i++) {
onetimedata = dataSet.getTimeData(i);
points = onetimedata.getnoOfPoints();
xarr = onetimedata.getxArr();
yarr = onetimedata.getyArr();
for (int j=0; j < points; j++)
onetimedata = new TimeData1D(dataSet.getTimeArr[i], points, xarr, yarr);
timeDataVec.addElement(onetimedata);
return new DataSet1D("x=x+c : " + dataSet.getTitle(), timeDataVec);