|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.jep.Log2Function
public class Log2Function
A JEP function class that adds a log2(expression)
function to a
JEP expression parser. The function will look take the 2-based logarithm of
it's argument.
This function is added automatically by the Jep.newJep(String, JepFunction[])
method to the parser.
Jep
Field Summary | |
---|---|
private static double |
LOG2
The natural logarithm of 2. |
private static Log2Function |
theInstance
The one and only instance of this function. |
Constructor Summary | |
---|---|
private |
Log2Function()
Create a new instance of this function. |
Method Summary | |
---|---|
boolean |
checkNumberOfParameters(int n)
|
String |
getFunctionName()
Get the name of this function. |
static Log2Function |
getInstance()
Get the singleton instance of this function. |
int |
getNumberOfParameters()
|
double |
log2(Number argument)
Calculate the 2-based logarithm of the argument. |
void |
run(Stack stack)
|
void |
setCurNumberOfParameters(int n)
|
Expression |
toExpression(Node node)
Use the Expressions.log2(Expression) method to create an
expression taking the 2-based logarithm of the argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Log2Function theInstance
private static final double LOG2
ln(x) / ln(2)
Constructor Detail |
---|
private Log2Function()
Method Detail |
---|
public static Log2Function getInstance()
public String getFunctionName()
JepFunction
JEP
parser.
getFunctionName
in interface JepFunction
JEP.addFunction(String, PostfixMathCommandI)
public Expression toExpression(Node node)
Expressions.log2(Expression)
method to create an
expression taking the 2-based logarithm of the argument.
toExpression
in interface JepExpressionFunction
node
- The node representing this function
Expression
objectpublic int getNumberOfParameters()
getNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void setCurNumberOfParameters(int n)
setCurNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public boolean checkNumberOfParameters(int n)
checkNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void run(Stack stack) throws ParseException
run
in interface org.nfunk.jep.function.PostfixMathCommandI
ParseException
public double log2(Number argument) throws ParseException
argument
- A number to calculate on
ParseException
- If the logarithm could not be calculated.
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |