2.17.2: 2011-06-17

net.sf.basedb.util.parser
Class LineNoFunction

java.lang.Object
  extended by net.sf.basedb.util.parser.LineNoFunction
All Implemented Interfaces:
JepFunction, org.nfunk.jep.function.PostfixMathCommandI

public class LineNoFunction
extends Object
implements JepFunction

Adds a lineNo() function to Jep. The lineNo() function is used with the FlatFileParser to get the current line number. Use the FlatFileParser.getMapper(String) with an argument starting with an equal sign to create a mapper that uses Jep.

FlatFileParser ffp = ...
Mapper lineNoMapper = ffp.getMapper("=lineNo()");
while (ffp.hasMoreData())
{
        Data data = ffp.nextData();
        int lineNumber = lineNoMapper.getInt(data);
}

Version:
2.4
Author:
nicklas
Last modified
$Date: 2008-09-11 22:08:14 +0200 (Thu, 11 Sep 2008) $

Field Summary
private  FlatFileParser.Data data
           
 
Constructor Summary
LineNoFunction()
           
 
Method Summary
 boolean checkNumberOfParameters(int n)
           
 String getFunctionName()
          Get the name of this function.
 int getNumberOfParameters()
           
 void run(Stack stack)
           
 void setCurNumberOfParameters(int n)
           
 void setData(FlatFileParser.Data data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

private FlatFileParser.Data data
Constructor Detail

LineNoFunction

public LineNoFunction()
Method Detail

getFunctionName

public String getFunctionName()
Description copied from interface: JepFunction
Get the name of this function. It is used when registering the function with a JEP parser.

Specified by:
getFunctionName in interface JepFunction
Returns:
The string "lineNo"
See Also:
JEP.addFunction(String, PostfixMathCommandI)

getNumberOfParameters

public int getNumberOfParameters()
Specified by:
getNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandI
Returns:
Always 0

setCurNumberOfParameters

public void setCurNumberOfParameters(int n)
Specified by:
setCurNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandI

checkNumberOfParameters

public boolean checkNumberOfParameters(int n)
Specified by:
checkNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandI

run

public void run(Stack stack)
         throws ParseException
Specified by:
run in interface org.nfunk.jep.function.PostfixMathCommandI
Throws:
ParseException

setData

public void setData(FlatFileParser.Data data)

2.17.2: 2011-06-17