View Javadoc
1   package org.djutils.eval;
2   
3   import org.djunits.value.vdouble.scalar.base.DoubleScalar;
4   
5   /**
6    * UnitParser.java.
7    * <p>
8    * Copyright (c) 2023-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
9    * for project information <a href="https://djutils.org" target="_blank"> https://djutils.org</a>. The DJUTILS project is
10   * distributed under a three-clause BSD-style license, which can be found at
11   * <a href="https://djutils.org/docs/license.html" target="_blank"> https://djutils.org/docs/license.html</a>.
12   * </p>
13   * @author <a href="https://www.tudelft.nl/pknoppers">Peter Knoppers</a>
14   */
15  public interface UnitParser
16  {
17      /**
18       * Parse a user-specific unit.
19       * @param value double; the value (already parsed; expressed in the unit)
20       * @param unit String; the unit specification
21       * @return DoubleScalar&lt;?,?&gt;; the resulting (strongly typed) value, or null if the user-specified parser cannot handle
22       *         the provided unit
23       */
24      DoubleScalar<?, ?> parseUnit(final double value, final String unit);
25  
26  }