org.nfunk.jep.function
Class Sum

java.lang.Object
  extended by org.nfunk.jep.function.PostfixMathCommand
      extended by org.nfunk.jep.function.Sum
All Implemented Interfaces:
PostfixMathCommandI

public class Sum
extends PostfixMathCommand

This class serves mainly as an example of a function that accepts any number of parameters. Note that the numberOfParameters is initialized to -1.


Field Summary
 
Fields inherited from class org.nfunk.jep.function.PostfixMathCommand
curNumberOfParameters, numberOfParameters
 
Constructor Summary
Sum()
          Constructor.
 
Method Summary
 void run(java.util.Stack stack)
          Calculates the result of summing up all parameters, which are assumed to be of the Double type.
 
Methods inherited from class org.nfunk.jep.function.PostfixMathCommand
checkNumberOfParameters, checkStack, getNumberOfParameters, setCurNumberOfParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sum

public Sum()
Constructor.

Method Detail

run

public void run(java.util.Stack stack)
         throws ParseException
Calculates the result of summing up all parameters, which are assumed to be of the Double type.

Specified by:
run in interface PostfixMathCommandI
Overrides:
run in class PostfixMathCommand
Throws:
ParseException


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