@Override
  public Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor)
      throws ProcessException {
    if (started) throw new IllegalStateException("Process can only be run once");
    started = true;

    if (monitor == null) monitor = new NullProgressListener();
    try {
      monitor.started();
      monitor.setTask(Text.text("Grabbing arguments"));
      monitor.progress(10.0f);

      SimpleFeatureCollection inputFeatures =
          (SimpleFeatureCollection)
              Params.getValue(input, PearsonCorrelationProcessFactory.inputFeatures, null);
      String inputFields =
          (String) Params.getValue(input, PearsonCorrelationProcessFactory.inputFields, null);
      if (inputFeatures == null || inputFields == null) {
        throw new NullPointerException("All parameters required");
      }

      monitor.setTask(Text.text("Processing ..."));
      monitor.progress(25.0f);

      if (monitor.isCanceled()) {
        return null; // user has canceled this operation
      }

      // start process
      PearsonOperation operation = new PearsonOperation();
      PearsonResult ret = operation.execute(inputFeatures, inputFields);
      // end process

      monitor.setTask(Text.text("Encoding result"));
      monitor.progress(90.0f);

      Map<String, Object> resultMap = new HashMap<String, Object>();
      resultMap.put(PearsonCorrelationProcessFactory.RESULT.key, ret);
      monitor.complete(); // same as 100.0f

      return resultMap;
    } catch (Exception eek) {
      monitor.exceptionOccurred(eek);
      return null;
    } finally {
      monitor.dispose();
    }
  }
 public InternationalString getDescription() {
   return Text.text(
       "Adds two double precision floating point numbers and returns the sum as a double");
 }
 public InternationalString getTitle() {
   return Text.text("DoubleAddition");
 }
public class DoubleAdditionFactory extends SingleProcessFactory {
  static final Parameter<Double> INPUT_A =
      new Parameter<Double>(
          "input_a", Double.class, Text.text("First value"), Text.text("First value to add"));
  static final Parameter<Double> INPUT_B =
      new Parameter<Double>(
          "input_b", Double.class, Text.text("Second value"), Text.text("Second value to add"));
  static final Parameter<Double> RESULT =
      new Parameter<Double>(
          "result", Double.class, Text.text("Result value"), Text.text("Result of addition"));

  static final Map<String, Parameter<?>> prameterInfo = new TreeMap<String, Parameter<?>>();

  static {
    prameterInfo.put(INPUT_A.key, INPUT_A);
    prameterInfo.put(INPUT_B.key, INPUT_B);
  }

  static final Map<String, Parameter<?>> resultInfo = new TreeMap<String, Parameter<?>>();

  static {
    resultInfo.put(RESULT.key, RESULT);
  }

  public DoubleAdditionFactory() {
    super(new NameImpl(GT_NAMESPACE, "DoubleAddition"));
  }

  public Process create(Map<String, Object> parameters) throws IllegalArgumentException {
    return new DoubleAdditionProcess(this);
  }

  public InternationalString getDescription() {
    return Text.text(
        "Adds two double precision floating point numbers and returns the sum as a double");
  }

  public Map<String, Parameter<?>> getParameterInfo() {
    return Collections.unmodifiableMap(prameterInfo);
  }

  public Map<String, Parameter<?>> getResultInfo(Map<String, Object> parameters)
      throws IllegalArgumentException {
    return Collections.unmodifiableMap(resultInfo);
  }

  public InternationalString getTitle() {
    return Text.text("DoubleAddition");
  }

  public Process create() throws IllegalArgumentException {
    return new DoubleAdditionProcess(this);
  }

  public boolean supportsProgress() {
    return true;
  }

  public String getVersion() {
    return "1.0.0";
  }
}