@@ -0,0 +1,1286 @@
+/*-%0A * Copyright (c) 2012 Diamond Light Source Ltd.%0A *%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A */%0A%0Apackage org.eclipse.dawnsci.analysis.dataset.impl.function;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.apache.commons.math3.complex.Complex;%0Aimport org.eclipse.dawnsci.analysis.api.dataset.IDataset;%0Aimport org.eclipse.dawnsci.analysis.dataset.impl.DatasetUtils;%0A%0A/**%0A * Example of finding the totals in an array of datasets%0A */%0Apublic class Sum implements DatasetToNumberFunction %7B%0A%0A%09@Override%0A%09public List%3CNumber%3E value(IDataset... datasets) %7B%0A%09%09if (datasets.length == 0)%0A%09%09%09return null;%0A%0A%09%09List%3CNumber%3E result = new ArrayList%3CNumber%3E();%0A%09%09for (IDataset d : datasets) %7B%0A%09%09%09Object value = DatasetUtils.convertToDataset(d).sum();%0A%09%09%09if (value instanceof Complex) %7B%0A%09%09%09%09result.add(((Complex) value).getReal());%0A%09%09%09%09result.add(((Complex) value).getImaginary());%0A%09%09%09%7D else if (value instanceof Number)%0A%09%09%09%09result.add((Number) value);%0A%09%09%09else %7B%0A%09%09%09%09throw new IllegalArgumentException(%22Type of return value from sum not supported%22);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return result;%0A%09%7D%0A%0A%7D%0A

Add missing function