package info.limpet.rcp.editors;

import info.limpet.ICollection;
import info.limpet.IOperation;
import info.limpet.data.operations.AddQuantityOperation;
import info.limpet.data.operations.DeleteCollectionOperation;
import info.limpet.data.operations.DivideQuantityOperation;
import info.limpet.data.operations.MultiplyQuantityOperation;
import info.limpet.data.operations.SubtractQuantityOperation;
import info.limpet.rcp.analysis_view.AnalysisView;
import info.limpet.rcp.data_frequency.DataFrequencyView;
import info.limpet.rcp.operations.ShowInNamedView;
import info.limpet.rcp.xy_plot.XyPlotView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class OperationsLibrary
{
	public static HashMap<String, List<IOperation<?>>> getOperations()
	{
		HashMap<String, List<IOperation<?>>> res = new HashMap<String, List<IOperation<?>>>();

		List<IOperation<?>> ops = new ArrayList<IOperation<?>>();
		ops.add(new MultiplyQuantityOperation());
		ops.add(new AddQuantityOperation<>());
		ops.add(new SubtractQuantityOperation<>());
		ops.add(new DivideQuantityOperation());

		List<IOperation<?>> admin = new ArrayList<IOperation<?>>();
		admin.add(new DeleteCollectionOperation());

		List<IOperation<?>> analysis = new ArrayList<IOperation<?>>();

		analysis.add(new ShowInNamedView("Show in XY Plot View", XyPlotView.ID)
		{
			protected boolean appliesTo(List<ICollection> selection)
			{
				return getTests().allQuantity(selection);
			}
		});
		analysis.add(new ShowInNamedView("Show in Data Frequency View",
				DataFrequencyView.ID));
		analysis.add(new ShowInNamedView("Show in Analysis View", AnalysisView.ID));

		res.put("Arithmetic", ops);
		res.put("Administration", admin);
		res.put("Analysis", analysis);
		return res;

	}
}

@@ -82,32 +82,81 @@
 pet.IOperation;%0A
+import info.limpet.data.impl.samples.StockTypes;%0A
 import info.limp
@@ -188,32 +188,32 @@
 ntityOperation;%0A
-
 import info.limp
@@ -434,32 +434,92 @@
 ntityOperation;%0A
+import info.limpet.data.operations.UnitConversionOperation;%0A
 import info.limp
@@ -783,16 +783,49 @@
 .List;%0A%0A
+import tec.units.ri.unit.Units;%0A%0A
 public c
@@ -1032,19 +1032,26 @@
 ion%3C?%3E%3E 
-ops
+arithmetic
  = new A
@@ -1075,27 +1075,34 @@
 on%3C?%3E%3E();%0A%09%09
-ops
+arithmetic
 .add(new Mul
@@ -1126,27 +1126,34 @@
 ation());%0A%09%09
-ops
+arithmetic
 .add(new Add
@@ -1170,35 +1170,42 @@
 eration%3C%3E());%0A%09%09
-ops
+arithmetic
 .add(new Subtrac
@@ -1235,44 +1235,661 @@
 ;%0A%09%09
-ops.add(new DivideQuantityOperation(
+arithmetic.add(new DivideQuantityOperation());%0A%0A%09%09List%3CIOperation%3C?%3E%3E conversions = new ArrayList%3CIOperation%3C?%3E%3E();%0A%09%09conversions.add(new UnitConversionOperation(Units.METRE));%0A%09%09conversions.add(new UnitConversionOperation(Units.SECOND));%0A%09%09conversions.add(new UnitConversionOperation(Units.MINUTE));%0A%09%09conversions.add(new UnitConversionOperation(Units.METRES_PER_SECOND));%0A%09%09conversions%0A%09%09%09%09.add(new UnitConversionOperation(Units.METRES_PER_SQUARE_SECOND));%0A%09%09conversions.add(new UnitConversionOperation(Units.CELSIUS));%0A%09%09conversions.add(new UnitConversionOperation(Units.RADIAN));%0A%09%09conversions.add(new UnitConversionOperation(StockTypes.DEGREE_ANGLE
 ));%0A
@@ -2462,18 +2462,64 @@
 metic%22, 
-op
+arithmetic);%0A%09%09res.put(%22Conversions%22, conversion
 s);%0A%09%09re

add conversions to operations library