Class BaseCurve

    • Constructor Detail

      • BaseCurve

        public BaseCurve()
    • Method Detail

      • numPoints

        public abstract int numPoints()
        Returns:
        The number of points in the curve
      • getX

        public abstract double[] getX()
        Returns:
        X axis values
      • getY

        public abstract double[] getY()
        Returns:
        Y-axis values
      • getTitle

        public abstract String getTitle()
        Returns:
        Title for the curve
      • calculateArea

        protected double calculateArea()
        Returns:
        Area under the curve
      • calculateArea

        protected double calculateArea​(double[] x,
                                       double[] y)
      • format

        protected String format​(double d,
                                int precision)
      • toJson

        public String toJson()
        Returns:
        JSON representation of the curve
      • toYaml

        public String toYaml()
        Returns:
        YAML representation of the curve
      • fromJson

        public static <T extends BaseCurve> T fromJson​(String json,
                                                       Class<T> curveClass)
        Type Parameters:
        T - Type
        Parameters:
        json - JSON representation
        curveClass - Class for the curve
        Returns:
        Instance of the curve
      • fromYaml

        public static <T extends BaseCurve> T fromYaml​(String yaml,
                                                       Class<T> curveClass)
        Type Parameters:
        T - Type
        Parameters:
        yaml - YAML representation
        curveClass - Class for the curve
        Returns:
        Instance of the curve