edu.psu.geovista.app.spreadsheet.functions
Class Function

java.lang.Object
  extended byedu.psu.geovista.app.spreadsheet.functions.Function
Direct Known Subclasses:
FunctionAverage, FunctionCount, FunctionCustomize, FunctionMedian, FunctionSin, FunctionSP, FunctionSum

public abstract class Function
extends java.lang.Object


Field Summary
protected  Formula owner
           
 
Constructor Summary
Function()
           
 
Method Summary
protected static void checkParamsExist(Node func)
           
abstract  java.lang.Number evaluate(Node node)
          This should be implemented in each function.
abstract  java.lang.String getDescription()
          Return the description of the function
protected  Node getFirst(Node param)
           
 Formula getOwner()
           
static SelectionRange getRangeArea(Node node)
          Jin: Only for those function whose arguments is set of range.
protected  float getSingleParameter(Node node)
          This gets the first float number of a parameter list, for functions only accepting a single parameter such as ABS, COS , etc.
protected  Function getSupportFuntion(java.lang.String fname, Formula owner)
           
abstract  java.lang.String getUsage()
          Return the usage of the function
protected  boolean isRange(Node param)
           
static SelectionRange processColonNode(Node colonNode)
          convert a colon node(which contain 2 ranges) into a SelectionRange
 boolean requireParams()
          Whether this function requires parameters.
 void setOwner(Formula owner)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

protected Formula owner
Constructor Detail

Function

public Function()
Method Detail

isRange

protected boolean isRange(Node param)

getFirst

protected Node getFirst(Node param)

checkParamsExist

protected static void checkParamsExist(Node func)
                                throws ParserException
Throws:
ParserException

getSingleParameter

protected float getSingleParameter(Node node)
                            throws ParserException,
                                   NoReferenceException
This gets the first float number of a parameter list, for functions only accepting a single parameter such as ABS, COS , etc.

Parameters:
node - the edu.psu.geovista.app.spreadsheet.formula unit
Returns:
the float number
Throws:
ParserException
NoReferenceException

evaluate

public abstract java.lang.Number evaluate(Node node)
                                   throws ParserException,
                                          NoReferenceException
This should be implemented in each function.

Parameters:
node - the function node starting with the funciton name with a chain of parameters
Throws:
ParserException
NoReferenceException

getUsage

public abstract java.lang.String getUsage()
Return the usage of the function


getDescription

public abstract java.lang.String getDescription()
Return the description of the function


requireParams

public boolean requireParams()
Whether this function requires parameters. By default yes.

See Also:
FunctionPI, FunctionE

getRangeArea

public static SelectionRange getRangeArea(Node node)
                                   throws ParserException
Jin: Only for those function whose arguments is set of range. e.g.: SUM, AVG,MEAN...

Parameters:
node - the function node.
Returns:
address(x,y) in view
Throws:
ParserException

processColonNode

public static SelectionRange processColonNode(Node colonNode)
                                       throws ParserException
convert a colon node(which contain 2 ranges) into a SelectionRange

Throws:
ParserException

getSupportFuntion

protected Function getSupportFuntion(java.lang.String fname,
                                     Formula owner)

setOwner

public void setOwner(Formula owner)

getOwner

public Formula getOwner()


Copyright © 1996-2003 GeoVista Center. All Rights Reserved.