Class SimpleCurve


  • public final class SimpleCurve
    extends FunctionCurve
    A SimpleCurve is a curve that's just a wrapper around java functions like Math.sin or Math.tan
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleCurve​(java.lang.String name)
      The constructor takes the name of the java method that represents the function.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double get​(double x)
      Return the value of the function at the specified X position.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • SimpleCurve

        public SimpleCurve​(java.lang.String name)
                    throws java.lang.NoSuchMethodException

        The constructor takes the name of the java method that represents the function. An example would be new SimpleCurve("java.lang.Math.sin")

        The argument must be the name of a static method that takes a single double parameter and returns a double. If it doesn't meet this criteria an exception is thrown.

        Parameters:
        name - The fully qualified name of the function
        Throws:
        java.lang.NoSuchMethodException - if the function doesn't exist, isn't static, doesn't take a double or doesn't return a double.
    • Method Detail

      • get

        public double get​(double x)
        Return the value of the function at the specified X position. The function may return NaN or an infinite value, but be warned - if it throws an exception, an Error is thrown by this method.
        Specified by:
        get in class Curve
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object