Class Curve

  • Direct Known Subclasses:
    DataCurve, FunctionCurve

    public abstract class Curve
    extends java.lang.Object

    The abstract superclass for all curves. A curve is what's plotted on a AbstractLineGraph, and has the property of always having a valid value between it's two end ranges - ie f(x) is valid for every min<=x<=max.

    All curves fall into one of two broad subclasses - a DataCurve, where the values of the curve reflect various data points, and a FunctionCurve, where the values of the curve reflect a mathematical function.

    See Also:
    DataCurve, FunctionCurve, Spline, Polynomial
    • Constructor Summary

      Constructors 
      Constructor Description
      Curve()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract double get​(double x)
      Return the value of this curve at the specified X position.
      abstract double getMax()
      Return the maximum value that is defined for this curve.
      abstract double getMin()
      Return the minimum value that is defined for this curve.
      abstract boolean point​(double x)
      If a marker is to be placed at this point on the curve then return true, otherwise return false.
      abstract double[] steps()
      Return the points on the curve that it should be sampled at to get an accurate picture of it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Curve

        public Curve()
    • Method Detail

      • get

        public abstract double get​(double x)
        Return the value of this curve at the specified X position. If the curve has no value at this point (i.e. x<curve min or x>curve max) return Double.NaN
      • steps

        public abstract double[] steps()
        Return the points on the curve that it should be sampled at to get an accurate picture of it. Subclasses of FunctionCurve may return an empty list if they wish, or if there are certain points that the curve must be sampled at, it can return them here.
      • point

        public abstract boolean point​(double x)
        If a marker is to be placed at this point on the curve then return true, otherwise return false. Most FunctionCurve will return false, but curves that have been fitted to a DataCurve may return any points from that DataCurve that are matched exactly by the fitted curve.
      • getMin

        public abstract double getMin()
        Return the minimum value that is defined for this curve. For curves with no minimum (like most mathematical functions), this should return Double.POSITIVE_INFINITY (yes, positive)
      • getMax

        public abstract double getMax()
        Return the maximum value that is defined for this curve. For curves with no maximum (like most mathematical functions), this should return Double.NEGATIVE_INFINITY (yes, negative)