/*- * Copyright 2015 Diamond Light Source Ltd. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package uk.ac.diamond.scisoft.analysis.processing.operations; import java.io.Serializable; import org.eclipse.dawnsci.analysis.api.processing.OperationData; import org.eclipse.dawnsci.analysis.api.processing.OperationException; import org.eclipse.dawnsci.analysis.api.processing.OperationRank; import org.eclipse.dawnsci.analysis.api.processing.model.EmptyModel; import org.eclipse.dawnsci.analysis.dataset.operations.AbstractOperation; import org.eclipse.january.IMonitor; import org.eclipse.january.dataset.Dataset; import org.eclipse.january.dataset.DatasetFactory; import org.eclipse.january.dataset.IDataset; public class DataWrittenOperation extends AbstractOperation<EmptyModel, OperationData> { @Override public String getId() { return "uk.ac.diamond.scisoft.analysis.processing.operations"; } protected OperationData process(IDataset input, IMonitor monitor) throws OperationException { Dataset ones = DatasetFactory.ones(new int[]{1}, Dataset.INT64); ones.setName("key"); return new OperationData(input, new Serializable[]{ones}); } @Override public OperationRank getInputRank() { return OperationRank.ANY; } @Override public OperationRank getOutputRank() { return OperationRank.SAME; } @Override public String getName(){ return "DataWritten"; } }