Converter.java

  1. package org.opentrafficsim.core.egtf;

  2. /**
  3.  * Converter for use in {@code Quantity} to convert internal filtered data to an output type.
  4.  * <p>
  5.  * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  6.  * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
  7.  * <p>
  8.  * @version $Revision$, $LastChangedDate$, by $Author$, initial version 24 okt. 2018 <br>
  9.  * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
  10.  * @param <K> grid output format
  11.  */
  12. public interface Converter<K>
  13. {
  14.     /** Standard converter that returns the internal SI data directly. */
  15.     Converter<double[][]> SI = new Converter<double[][]>()
  16.     {
  17.         /** {@inheritDoc} */
  18.         @Override
  19.         public double[][] convert(final double[][] filteredData)
  20.         {
  21.             return filteredData;
  22.         }

  23.         /** {@inheritDoc} */
  24.         @Override
  25.         public String toString()
  26.         {
  27.             return "Converter SI";
  28.         }
  29.     };

  30.     /**
  31.      * Convert the filtered data to an output format.
  32.      * @param filteredData double[][]; filtered data
  33.      * @return K; data in output format
  34.      */
  35.     K convert(double[][] filteredData);
  36. }