|
Copyright (C) 2003,2004 dr. Cristiano Sadun | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sadun.text.ffp.MatchingRegexpInLineCondition
A condition that checks a regular expression in a physical line.
Constructor Summary | |
MatchingRegexpInLineCondition(int physicalLine,
java.lang.String regexp,
int startPosition)
Create a condition which will look for the given constant at the given position of the given physical line in the file. |
|
MatchingRegexpInLineCondition(int physicalLine,
java.lang.String regexp,
LineFormat format,
int n)
Create a condition which will look at the value of the nth field of the given physical line in the given LineFormat object.
|
|
MatchingRegexpInLineCondition(java.lang.String regexp,
int startPosition)
Create a condition which will look for the given regexp at the given position of the next line in the file. |
|
MatchingRegexpInLineCondition(java.lang.String regexp,
LineFormat format,
int n)
Create a condition which will look at the value of the nth field of the given physical line in the given LineFormat object.
|
Method Summary | |
boolean |
holds(int logicalLineCount,
int physicalLineCount,
FlatFileParser.LineReader reader)
Attempt to match the regular expression and line position provided at construction to the physical line. |
protected java.lang.String |
readPhysicalLines(FlatFileParser.LineReader reader,
int n)
Read n physical lines and returns the n-th. |
java.lang.String |
toString()
Return a human-readable description of the condition. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MatchingRegexpInLineCondition(int physicalLine, java.lang.String regexp, int startPosition)
physicalLine
- the physical line in which the constant is to be looked forregexp
- the regular expression to matchstartPosition
- the position in the physical line where to look for the constantpublic MatchingRegexpInLineCondition(java.lang.String regexp, int startPosition)
regexp
- the regular expression to matchstartPosition
- the position in the line where to look for the regexppublic MatchingRegexpInLineCondition(int physicalLine, java.lang.String regexp, LineFormat format, int n)
LineFormat
object.
The field must have type Type.CONSTANT
.
This constructor is useful when a LineFormat
has already been defined with
the regexp value to be looked for by this condition.
format
- the LineFormat
from which to get the regexp valueregexp
- the regular expression to matchphysicalLine
- the physical line of the field (starting with 1)n
- the number of the field (starting with 1)public MatchingRegexpInLineCondition(java.lang.String regexp, LineFormat format, int n)
LineFormat
object.
The field must have type Type.CONSTANT
.
This constructor is useful when a LineFormat
has already been defined with
the regexp value to be looked for by this condition.
format
- the LineFormat
from which to get the regexp valueregexp
- the regular expression to matchn
- the number of the field (starting with 1)Method Detail |
public boolean holds(int logicalLineCount, int physicalLineCount, FlatFileParser.LineReader reader) throws java.io.IOException
holds
in interface FlatFileParser.Condition
logicalLineCount
- the logical lines read so farphysicalLineCount
- the physical lines read so farreader
- an object allowing to read lines on the file
java.io.IOException
- if a I/O problem arises when reading linesFlatFileParser.Condition.holds(int, int, org.sadun.text.ffp.FlatFileParser.LineReader)
protected java.lang.String readPhysicalLines(FlatFileParser.LineReader reader, int n) throws java.io.IOException
If no enough lines exist, null is returned.
reader
- n
-
java.io.IOException
public java.lang.String toString()
FlatFileParser.Condition
toString
in interface FlatFileParser.Condition
|
Copyright (C) 2003,2004 dr. Cristiano Sadun | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |