|
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.ConstantFoundInLineCondition
A condition that looks for a matching constant into a specific physical line.
Constructor Summary | |
ConstantFoundInLineCondition(int physicalLine,
LineFormat format)
Create a condition which will look at the value of the first constant field in the given physical line of the given LineFormat object.
|
|
ConstantFoundInLineCondition(int physicalLine,
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.
|
|
ConstantFoundInLineCondition(int physicalLine,
java.lang.String constant,
int startPosition)
Create a condition which will look for the given constant at the given position of the given physical line in the file. |
|
ConstantFoundInLineCondition(LineFormat format)
Create a condition which will look at the value of the first constant field of in the given LineFormat object.
|
|
ConstantFoundInLineCondition(LineFormat format,
int n)
Create a condition which will look at the value of the nth field in the given LineFormat object.
|
|
ConstantFoundInLineCondition(java.lang.String constant,
int startPosition)
Create a condition which will look for the given constant at the given position of the next line in the file. |
Method Summary | |
boolean |
holds(int logicalLineCount,
int physicalLineCount,
FlatFileParser.LineReader reader)
Return true if a desired logical condition holds. |
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 ConstantFoundInLineCondition(int physicalLine, java.lang.String constant, int startPosition)
physicalLine
- the physical line in which the constant is to be looked forconstant
- the constant to look forstartPosition
- the position in the physical line where to look for the
constantpublic ConstantFoundInLineCondition(java.lang.String constant, int startPosition)
constant
- the constant to look forstartPosition
- the position in the line where to look for the constantpublic ConstantFoundInLineCondition(int physicalLine, 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 constant value to be looked for by this condition.
format
- the LineFormat
from which to get the constant valuephysicalLine
- the physical line of the field (starting with 1)n
- the number of the field (starting with 1)public ConstantFoundInLineCondition(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 constant value to be looked for by this condition.
format
- the LineFormat
from which to get the constant valuen
- the number of the field (starting with 1)public ConstantFoundInLineCondition(int physicalLine, LineFormat format)
LineFormat
object.
The format must have at least one field defined as type
Type.CONSTANT
.
This constructor is useful when a LineFormat
has already been
defined with the constant value to be looked for by this condition.
format
- the LineFormat
from which to get the constant valuephysicalLine
- the physical line of the field (starting with 1)
java.lang.IllegalArgumentException
- if the given format does not have any
constant
field.public ConstantFoundInLineCondition(LineFormat format)
LineFormat
object.
The format must have at least one field defined as type
Type.CONSTANT
.
This constructor is useful when a LineFormat
has already been
defined with the constant value to be looked for by this condition.
format
- the LineFormat
from which to get the constant value
java.lang.IllegalArgumentException
- if the given format does not have any
constant
field.Method Detail |
public boolean holds(int logicalLineCount, int physicalLineCount, FlatFileParser.LineReader reader) throws java.io.IOException
FlatFileParser.Condition
Note that the implementation can use the reader object to read as many lines as necessary to verify if a certain condition holds - but should return false unless an IOException due to real i/o problems (and not, for example, that not enough lines exist on the file and therefore EOF is reached) is raised.
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 linesprotected 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 |