Copyright (C) 2003,2004 dr. Cristiano Sadun

org.sadun.text.ffp
Class ConstantLineCondition

java.lang.Object
  extended byorg.sadun.text.ffp.ConstantLineCondition
All Implemented Interfaces:
FlatFileParser.Condition

public class ConstantLineCondition
extends java.lang.Object
implements FlatFileParser.Condition

A condition which holds only if the next line on the file is identical to the a given constant.

Author:
Cristiano Sadun

Constructor Summary
ConstantLineCondition(java.lang.String constant)
          Create a condition which use the given constant.
 
Method Summary
 java.lang.String getConstant()
          Return the constant used by this condition.
 boolean holds(int logicalLineCount, int physicalLineCount, FlatFileParser.LineReader reader)
          Return true if there is one physical line available in the file, and it is identical to the constant provided at construction.
 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

ConstantLineCondition

public ConstantLineCondition(java.lang.String constant)
Create a condition which use the given constant.

Parameters:
constant - the constant to use
Method Detail

holds

public boolean holds(int logicalLineCount,
                     int physicalLineCount,
                     FlatFileParser.LineReader reader)
              throws java.io.IOException
Return true if there is one physical line available in the file, and it is identical to the constant provided at construction.

Specified by:
holds in interface FlatFileParser.Condition
Parameters:
logicalLineCount - the logical lines read so far
physicalLineCount - the physical lines read so far
reader - an object allowing to read lines on the file
Returns:
true if the conditions hold, false otherwise.
Throws:
java.io.IOException - if a I/O problem arises when reading lines

getConstant

public java.lang.String getConstant()
Return the constant used by this condition.

Returns:
the constant used by this condition.

toString

public java.lang.String toString()
Description copied from interface: FlatFileParser.Condition
Return a human-readable description of the condition.

Specified by:
toString in interface FlatFileParser.Condition

Copyright (C) 2003,2004 dr. Cristiano Sadun