Back to index

wims  3.65+svn20090927
Public Member Functions | Private Attributes
org.javia.arity.Constant Class Reference
Inheritance diagram for org.javia.arity.Constant:
Inheritance graph
[legend]
Collaboration diagram for org.javia.arity.Constant:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Constant (double value)
double eval ()
 Evaluates an arity-0 function (a function with no arguments).
 Constant (double value)
double eval ()
 Evaluates an arity-0 function (a function with no arguments).
int arity ()
 Gives the arity of this function.
int arity ()
 Gives the arity of this function.
double eval (double x) throws ArityException
double eval (double x, double y) throws ArityException
double eval (double args[]) throws ArityException
 Evaluates the function given the argument values.

Private Attributes

double value

Detailed Description

Definition at line 19 of file Constant.java.


Constructor & Destructor Documentation

org.javia.arity.Constant.Constant ( double  value) [inline]

Definition at line 22 of file Constant.java.

                                  {
        this.value = value;
    }
org.javia.arity.Constant.Constant ( double  value) [inline]

Definition at line 22 of file Constant.java.

                                  {
        this.value = value;
    }

Member Function Documentation

int org.javia.arity.Function.arity ( ) [inline, inherited]

Gives the arity of this function.

Returns:
the arity (the number of arguments). Arity >= 0.

Reimplemented in org.javia.arity.CompiledFunction, and org.javia.arity.CompiledFunction.

Definition at line 44 of file Function.java.

                       {
        if (cachedArity == -1) {
            cachedArity = 0;
            for (int i = 0; i < 5; ++i) {
                double args[] = new double[i];
                try {
                    eval(args);
                    cachedArity = i;
                    break;
                } catch (ArityException e) {
                    //ignore, continue
                }
            }
        }
        return cachedArity;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

int org.javia.arity.Function.arity ( ) [inline, inherited]

Gives the arity of this function.

Returns:
the arity (the number of arguments). Arity >= 0.

Reimplemented in org.javia.arity.CompiledFunction, and org.javia.arity.CompiledFunction.

Definition at line 44 of file Function.java.

                       {
        if (cachedArity == -1) {
            cachedArity = 0;
            for (int i = 0; i < 5; ++i) {
                double args[] = new double[i];
                try {
                    eval(args);
                    cachedArity = i;
                    break;
                } catch (ArityException e) {
                    //ignore, continue
                }
            }
        }
        return cachedArity;
    }

Here is the call graph for this function:

double org.javia.arity.Constant.eval ( ) [inline]

Evaluates an arity-0 function (a function with no arguments).

Returns:
the value of the function

Reimplemented from org.javia.arity.Function.

Definition at line 27 of file Constant.java.

                         {
        return value;
    }
double org.javia.arity.Constant.eval ( ) [inline]

Evaluates an arity-0 function (a function with no arguments).

Returns:
the value of the function

Reimplemented from org.javia.arity.Function.

Definition at line 27 of file Constant.java.

                         {
        return value;
    }
double org.javia.arity.Function.eval ( double  x) throws ArityException [inline, inherited]

Reimplemented in org.javia.arity.CompiledFunction, and org.javia.arity.CompiledFunction.

Definition at line 69 of file Function.java.

                                                       {
        throw new ArityException("Didn't expect 1 args");
    }
double org.javia.arity.Function.eval ( double  x,
double  y 
) throws ArityException [inline, inherited]

Reimplemented in org.javia.arity.CompiledFunction, and org.javia.arity.CompiledFunction.

Definition at line 73 of file Function.java.

                                                                 {
        throw new ArityException("Didn't expect 2 args");
    }
double org.javia.arity.Function.eval ( double  args[]) throws ArityException [inline, inherited]

Evaluates the function given the argument values.

Parameters:
argsarray containing the arguments.
Returns:
the value of the function
Exceptions:
ArityExceptionif args.length != arity.

Reimplemented in org.javia.arity.CompiledFunction, and org.javia.arity.CompiledFunction.

Definition at line 83 of file Function.java.

                                                            {
        switch (args.length) {
        case 0:
            return eval();
        case 1:
            return eval(args[0]);
        case 2:
            return eval(args[0], args[1]);
        }
        throw new ArityException("unexpected " + args.length + " args");
    }

Here is the call graph for this function:


Member Data Documentation

Definition at line 20 of file Constant.java.


The documentation for this class was generated from the following files: