Class TabulatedValues<X,Y>

java.lang.Object
net.simplace.sim.components.util.helper.TabulatedValues<X,Y>
Type Parameters:
X - Type of X column values (Double, Integer or String)
Y - Type of Y column values (Double, Integer or String)

public class TabulatedValues<X,Y> extends Object
Handles tabulated values (X and Y column) and returns for a x-value a y-value by using the table (lookup, interpolation etc.)
Author:
Gunther Krauss
  • Constructor Details

    • TabulatedValues

      public TabulatedValues(net.simplace.sim.util.FWSimVariable<X[]> tx, net.simplace.sim.util.FWSimVariable<Y[]> ty)
      Creates Tabulated Values from two array valued SimVariables
      Parameters:
      tx - SimVariable for x values
      ty - SimVariable for y values
  • Method Details

    • getValueAt

      public Y getValueAt(X x)
      Returns for a value x a coresponding value y by using tabulated data. If X and Y columns are numeric, then y is interpolated (or extrapolated). If Y column is integer, then the interpolated value is rounded to integer too. If X column is numeric and Y column a String, then y is taken from the first row where x is equal or greater than the X-column value. If X column is a String, then a lookup is performed by returning the y value from the row where x is found. If x is not found, then null is returned.
      Parameters:
      x - x-value
      Returns:
      y-value coresponding to x-value
    • calcValue

      protected Y calcValue(String x, String[] xv, Y[] yv)
    • calcValue

      protected String calcValue(Number x, Number[] xv, String[] yv)
    • calcValue

      protected Integer calcValue(Integer x, Integer[] xv, Integer[] yv)
    • calcValue

      protected Double calcValue(Integer x, Integer[] xv, Double[] yv)
    • calcValue

      protected Integer calcValue(Double x, Double[] xv, Integer[] yv)
    • calcValue

      protected Double calcValue(Double x, Double[] xv, Double[] yv)