Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.lsmp.djep.xjep.function
Class Define

    java.lang.Object
      org.nfunk.jep.function.PostfixMathCommand
          org.lsmp.djep.xjep.function.Define

All Implemented Interfaces:
  CommandVisitorI, PostfixMathCommandI

    public class Define

extends PostfixMathCommand
implements CommandVisitorI

Allows functions to be defined in equations.

     XJep > Define("half",1,"x/2")
     XJep > half(5)

Currently the Define function is handled in the preprocessing step

     Node n = xj.parse("Define(\"sumToX\",1,\"x*(x+1)/2\")");
     Node preproc = xj.preprocess(n);

and preproc will be null if a Define statement is encountered. This is probably a bug. TODO improve syntax. So can have Define("half(x)",x/2) TODO work out how to simplify and evaluate Define statements which don't really have a value. TODO fix parser so can do half(x) = x/2

Author:
  Rich Morris Created on 21-Jul-2005

Field Summary

Fields inherited from class org.nfunk.jep.function.PostfixMathCommand
`curNumberOfParameters, numberOfParameters`

Constructor Summary
`Define(XJep xj)`

Method Summary
`Node` | `process(Node node, Node[] children, XJep xjep)` Performs the specified action on an expression tree.

Methods inherited from class org.nfunk.jep.function.PostfixMathCommand
`checkNumberOfParameters, checkStack, getNumberOfParameters, run, setCurNumberOfParameters`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Define

    public Define(XJep xj)

Method Detail

### process

    public Node process(Node node,
                        Node[] children,
                        XJep xjep)
                 throws ParseException

  Description copied from interface: `CommandVisitorI`
  Performs the specified action on an expression tree.

  Specified by:
    `process` in interface `CommandVisitorI`
  Parameters:
    `node` - top node of the tree
    `children` - the children of the node after they have been preprocessed.
    `xjep` - a reference to the current XJep interface.
  Returns:
    top node of the results.
  Throws:
    `ParseException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

http://www.singularsys.com/jep Copyright © 2007 Singular Systems