com.hedgehog.math.functions
Class OneVariableDoubleVector3DFunction

java.lang.Object
  extended by com.hedgehog.HObject
      extended by com.hedgehog.math.functions.Function
          extended by com.hedgehog.math.functions.OneVariableDoubleVector3DFunction
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator

public class OneVariableDoubleVector3DFunction
extends Function

Title: OneVariableDoubleVector3DFunction - represents a one-argument function with signature: HDouble Function(Vector3D).

Description: Represents a one-argument method with signature: Vector3D Function(Vector3D).

Copyright: Copyright (c) Hedgehog Software 2007-2009.

Company: Hedgehog Software

Since:
1.0
Version:
1.1

Field Summary
 
Fields inherited from class com.hedgehog.math.functions.Function
method
 
Fields inherited from class com.hedgehog.HObject
mID, mName
 
Constructor Summary
OneVariableDoubleVector3DFunction()
          Default constructor.
OneVariableDoubleVector3DFunction(java.lang.reflect.Method method)
           Constructor.
OneVariableDoubleVector3DFunction(OneVariableDoubleVector3DFunction object)
          Copy constructor.
OneVariableDoubleVector3DFunction(java.lang.String className, java.lang.String methodName)
          Constructor.
 
Method Summary
 Vector3D evaluate(java.lang.Object object, Vector3D x)
          Evaluates the method for the supplied invoking object and argument.
 boolean isValid()
          Tests whether or not a valid object.
static boolean isValid(java.lang.reflect.Method m)
          Static version of isValid().
 
Methods inherited from class com.hedgehog.math.functions.Function
getMethod, setMethod, toString
 
Methods inherited from class com.hedgehog.HObject
clone, compare, compareTo, copy, equals, getID, getName, hashCode, hasID, hasName, setID, setName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OneVariableDoubleVector3DFunction

public OneVariableDoubleVector3DFunction()
Default constructor. Sets the method to null.


OneVariableDoubleVector3DFunction

public OneVariableDoubleVector3DFunction(java.lang.reflect.Method method)
                                  throws java.lang.IllegalArgumentException

Constructor. Sets the function to the specified method. Encapsulated method is set to null if an invalid object is specified. For example:

 Class              c           = Class.forName("com.hedgehog.X") ;
 Class              funcArg     = Class.forName("com.hedgehog.math.Vector3D");
 Class[]            funcArgs    = { funcArg } ;
 Method             function    = c.getMethod("function",funcArgs) ;
 OneVariableVector3DFunction   v3df = new OneVariableVector3DFunction(function);
 

Parameters:
method - Function operated-on.
Throws:
java.lang.IllegalArgumentException - Thrown if an invalid method is supplied. If exception thrown then encapsulated method is set to null.

OneVariableDoubleVector3DFunction

public OneVariableDoubleVector3DFunction(java.lang.String className,
                                         java.lang.String methodName)
                                  throws java.lang.IllegalArgumentException
Constructor. Sets the function to the specified method, methodName by its String name. The class name, className, is also required and must be fully qualified. For example: OneVariableVector3DFunction v3df = new OneVariableVector3DFunction("hedgehog.X","function"); Encapsulated method is set to null if an invalid object is specified.

Parameters:
className - Fully qualified name of class that method belongs to.
methodName - Name of function operated-on.
Throws:
java.lang.IllegalArgumentException - Thrown if an invalid method is supplied. If exception thrown then encapsulated method is set to null.

OneVariableDoubleVector3DFunction

public OneVariableDoubleVector3DFunction(OneVariableDoubleVector3DFunction object)
Copy constructor.

Parameters:
object - Object to copy.
Method Detail

evaluate

public Vector3D evaluate(java.lang.Object object,
                         Vector3D x)
Evaluates the method for the supplied invoking object and argument. Facilitates evaluating the method by placing the try-catch block inside evaluate().

Parameters:
object - Invoking object.
x - Argument value.
Returns:
Evaluation of the method call with the supplied argument. If an error occurs invoking the method then a null object is returned.

isValid

public boolean isValid()
Tests whether or not a valid object. Tests if the supplied method has 1 argument of type Vector3D and returns type Vector3D.

Specified by:
isValid in class Function
Returns:
Logical-true if a valid object, else logical-false.

isValid

public static boolean isValid(java.lang.reflect.Method m)
Static version of isValid(). Tests whether or not a valid object. Tests if the supplied method has 1 argument of type Vector3D and returns type Vector3D.

Parameters:
m - Method to test validity of.
Returns:
Logical-true if a valid object, else logical-false.